Versions in this module Expand all Collapse all v0 v0.6.1 Dec 13, 2021 v0.6.0 Dec 13, 2021 Changes in this version + type AccountCallback func(key interface{}, value interface{}) int + type EvictCallback 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, 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, 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 LRUWithAccounting struct + func NewLRUWithAccounting(limit int, onAccount AccountCallback, onEvict EvictCallback) (*LRUWithAccounting, error) + func (c *LRUWithAccounting) AccountingSize() int + func (c *LRUWithAccounting) Add(key, value interface{}) (evicted bool) + func (c *LRUWithAccounting) Contains(key interface{}) (ok bool) + func (c *LRUWithAccounting) Get(key interface{}) (value interface{}, ok bool) + func (c *LRUWithAccounting) GetOldest() (key, value interface{}, ok bool) + func (c *LRUWithAccounting) Keys() []interface{} + func (c *LRUWithAccounting) Len() int + func (c *LRUWithAccounting) Peek(key interface{}) (value interface{}, ok bool) + func (c *LRUWithAccounting) Purge() + func (c *LRUWithAccounting) Remove(key interface{}) (present bool) + func (c *LRUWithAccounting) RemoveOldest() (key, value interface{}, ok bool) + func (c *LRUWithAccounting) Resize(size int) (evicted int)