Versions in this module Expand all Collapse all v0 v0.1.0 Mar 18, 2022 Changes in this version + type EvictCallback func(key Key, value Value) + type LRU struct + func NewLRU(size int, onEvict EvictCallback[Key, Value]) (*LRU[Key, Value], error) + func (c *LRU[Key, Value]) Add(key Key, value Value) (evicted bool) + func (c *LRU[Key, Value]) Contains(key Key) (ok bool) + func (c *LRU[Key, Value]) Get(key Key) (value Value, ok bool) + func (c *LRU[Key, Value]) GetOldest() (key Key, value Value, ok bool) + func (c *LRU[Key, Value]) Keys() []Key + func (c *LRU[Key, Value]) Len() int + func (c *LRU[Key, Value]) Peek(key Key) (value Value, ok bool) + func (c *LRU[Key, Value]) Purge() + func (c *LRU[Key, Value]) Remove(key Key) (present bool) + func (c *LRU[Key, Value]) RemoveOldest() (key Key, value Value, ok bool) + func (c *LRU[Key, Value]) Resize(size int) (evicted int) + type LRUCache interface + Add func(key Key, value Value) bool + Contains func(key Key) (ok bool) + Get func(key Key) (value Value, ok bool) + GetOldest func() (Key, Value, bool) + Keys func() []Key + Len func() int + Peek func(key Key) (value Value, ok bool) + Purge func() + Remove func(key Key) bool + RemoveOldest func() (Key, Value, bool) + Resize func(int) int