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)
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.
cache map[interface{}]*list.Element
ll *list.List
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.
(*T) removeElement(e *list.Element)
*T : github.com/aws/aws-sdk-go/aws/corehandlers.lener
func New(maxEntries int) *Cache
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.
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |