Versions in this module Expand all Collapse all v0 v0.5.4 Oct 22, 2019 v0.1.0 Oct 18, 2019 Changes in this version + type EvictCallback func(key interface{}, value interface{}) + type EvictCallbackTtl func(key interface{}, value interface{}) + type LRU struct + func NewLRU(size int, onEvict EvictCallback) (*LRU, error) + func (c *LRU) Add(key, value interface{}) (evicted bool) + func (c *LRU) Contains(key interface{}) (ok bool) + func (c *LRU) Get(key interface{}) (value interface{}, ok bool) + func (c *LRU) GetOldest() (key interface{}, value interface{}, ok bool) + func (c *LRU) Keys() []interface{} + func (c *LRU) Len() int + func (c *LRU) Peek(key interface{}) (value interface{}, ok bool) + func (c *LRU) Purge() + func (c *LRU) Remove(key interface{}) (present bool) + func (c *LRU) RemoveOldest() (key interface{}, value interface{}, ok bool) + func (c *LRU) Resize(size int) (evicted int) + type LRUCache interface + Add func(key, value interface{}) bool + Contains func(key interface{}) (ok bool) + Get func(key interface{}) (value interface{}, ok bool) + GetOldest func() (interface{}, interface{}, bool) + Keys func() []interface{} + Len func() int + Peek func(key interface{}) (value interface{}, ok bool) + Purge func() + Remove func(key interface{}) bool + RemoveOldest func() (interface{}, interface{}, bool) + Resize func(int) int + type LRUTtl struct + func NewLRUTtl(size int, expiry time.Duration, onEvict EvictCallbackTtl) (*LRUTtl, error) + func (c *LRUTtl) Add(key, value interface{}) (evicted bool) + func (c *LRUTtl) Contains(key interface{}) (ok bool) + func (c *LRUTtl) Get(key interface{}) (value interface{}, ok bool) + func (c *LRUTtl) GetOldest() (key interface{}, value interface{}, ok bool) + func (c *LRUTtl) Keys() []interface{} + func (c *LRUTtl) Len() int + func (c *LRUTtl) Peek(key interface{}) (value interface{}, ok bool) + func (c *LRUTtl) Purge() + func (c *LRUTtl) Remove(key interface{}) (present bool) + func (c *LRUTtl) RemoveOldest() (key interface{}, value interface{}, ok bool) + func (c *LRUTtl) Resize(size int) (evicted int)