Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DropValueCallback ¶
type DropValueCallback func(key string, val interface{})
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
LRUCache is a fixed-size cache of key/value pairs. The lookup map is used to access values by their key. The LRU doubly-linked list is used to track entries from the least-recently used (the head) to the most recently used (the tail). An optional callback notifies the application when a value is dropped so it can be destroyed.
func NewLRUCache ¶
func NewLRUCache(size int, dropVal DropValueCallback) *LRUCache
NewLRUCache creates an LRU cache of a given size. An optional callback is invoked when a value is dropped from the cache, either overwritten or evicted.
Click to show internal directories.
Click to hide internal directories.