Documentation ¶
Overview ¶
Package lru provides a LRU cache implementation
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EvictionListener ¶
type EvictionListener func(key string, value interface{})
EvictionListener functions will be notified when an element from the LRU is removed via evition (not deletion or replacement).
type LRU ¶
type LRU struct {
// contains filtered or unexported fields
}
LRU is the basic implementation of an LRU cache
func New ¶
func New(size int, listener EvictionListener) *LRU
New will create a LRU instance with the given size of elements
func (*LRU) Peek ¶
Peek will fetch the value for the given key or return nil if it does not exist. This function will not update the LRU index.
Click to show internal directories.
Click to hide internal directories.