Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EvictionNotice ¶
EvictionNotice is invoked when an entry is evicted from the cache.
type Interface ¶
type Interface interface { Get(string) (payload.Payload, bool) Add(string, payload.Payload) Purge() }
func NewLRU ¶
func NewLRU(capacity int, notify EvictionNotice) Interface
NewLRU creates a thread-safe cache with LRU as its eviction policy. Entries are evicted when the size is about to exceed the capacity. EvictionNotice callback is used whenever an entry is being evicted.
Click to show internal directories.
Click to hide internal directories.