Help us shape the future of Go! Take the 2026 Go Developer Survey

cache

package
v0.1.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 1 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key added in v0.1.5

type Key = lru.Key

Key is an alias of lru.Key

type LRUCache added in v0.1.13

type LRUCache interface {
	// Add adds a value to the cache.
	Add(key Key, value interface{})
	// Get looks up a key's value from the cache.
	Get(key Key) (interface{}, bool)
	// Remove removes the provided key from the cache.
	Remove(key Key)
	// RemoveOldest removes the oldest item from the cache.
	RemoveOldest()
	// Len returns the number of items in the cache.
	Len() int
	// Clear purges all stored items from the cache.
	Clear()
	// Range call f on every key
	Range(f func(key Key, value interface{}) bool)
}

func NewDummyLruCache added in v0.1.13

func NewDummyLruCache() LRUCache

NewDummyLruCache returns a dummy lru cache

func NewThreadSafeLruCache

func NewThreadSafeLruCache(maxEntries int) LRUCache

NewThreadSafeLruCache returns a thread safe lru cache with fix size

func NewThreadSafeLruCacheWithOnEvicted added in v0.1.5

func NewThreadSafeLruCacheWithOnEvicted(maxEntries int, onEvicted func(key Key, value interface{})) LRUCache

NewThreadSafeLruCacheWithOnEvicted returns a thread safe lru cache with fix size

Directories

Path Synopsis
Package lru implements an LRU cache.
Package lru implements an LRU cache.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL