package lru

Import Path
	github.com/golang/groupcache/lru (on go.dev)

Dependency Relation
	imports one package, and imported by one package

Involved Source Files Package lru implements an LRU cache.
Package-Level Type Names (total 3, in which 2 are exported)
/* sort exporteds by: | */
Cache is an LRU cache. It is not safe for concurrent access. MaxEntries is the maximum number of cache entries before an item is evicted. Zero means no limit. OnEvicted optionally specifies a callback function to be executed when an entry is purged from the cache. Add adds a value to the cache. Clear purges all stored items from the cache. Get looks up a key's value from the cache. Len returns the number of items in the cache. Remove removes the provided key from the cache. RemoveOldest removes the oldest item from the cache. func New(maxEntries int) *Cache
A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators func (*Cache).Add(key Key, value interface{}) func (*Cache).Get(key Key) (value interface{}, ok bool) func (*Cache).Remove(key Key)
Package-Level Functions (only one, which is exported)
New creates a new Cache. If maxEntries is zero, the cache has no limit and it's assumed that eviction is done by the caller.