Documentation ¶
Overview ¶
Package lru implements an LRU cache.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is an LRU cache, safe for concurrent access.
func (*Cache) Add ¶
Add adds the provided key and value to the cache, evicting an old item if necessary.
func (*Cache) Get ¶
Get fetches the key's value from the cache. The ok result will be true if the item was found.
func (*Cache) RemoveOldest ¶
RemoveOldest removes the oldest item in the cache and returns its key and value. If the cache is empty, the empty string and nil are returned.
Click to show internal directories.
Click to hide internal directories.