Documentation ¶
Overview ¶
Package lru implements a LRU cache.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { // MaxEntries is the maximum number of cache entries // before an item is purged. Zero means no limit. MaxEntries int // OnPurged specifies a function to be executed // when an entry is purged from the cache. OnPurged func(key interface{}, value interface{}) // contains filtered or unexported fields }
Cache is a LRU cache.
func (*Cache) Add ¶
func (c *Cache) Add(key interface{}, value interface{})
Add adds value to the cache.
func (*Cache) Remove ¶
func (c *Cache) Remove(key interface{})
Remove removes the provided key from the cache.
func (*Cache) RemoveOldest ¶
func (c *Cache) RemoveOldest()
RemoveOldest removes the oldest item from the cache.
Click to show internal directories.
Click to hide internal directories.