Versions in this module Expand all Collapse all v0 v0.1.0 Mar 18, 2022 Changes in this version + const Default2QGhostEntries + const Default2QRecentRatio + const DefaultEvictedBufferSize + type ARCCache struct + func NewARC(size int) (*ARCCache[Key, Value], error) + func (c *ARCCache[Key, Value]) Add(key Key, value Value) + func (c *ARCCache[Key, Value]) Contains(key Key) bool + func (c *ARCCache[Key, Value]) Get(key Key) (value Value, ok bool) + func (c *ARCCache[Key, Value]) Keys() []Key + func (c *ARCCache[Key, Value]) Len() int + func (c *ARCCache[Key, Value]) Peek(key Key) (value Value, ok bool) + func (c *ARCCache[Key, Value]) Purge() + func (c *ARCCache[Key, Value]) Remove(key Key) + type Cache struct + func New(size int) (*Cache[Key, Value], error) + func NewWithEvict(size int, onEvicted func(key Key, value Value)) (c *Cache[Key, Value], err error) + func (c *Cache[Key, Value]) Add(key Key, value Value) (evicted bool) + func (c *Cache[Key, Value]) Contains(key Key) bool + func (c *Cache[Key, Value]) ContainsOrAdd(key Key, value Value) (ok, evicted bool) + func (c *Cache[Key, Value]) Get(key Key) (value Value, ok bool) + func (c *Cache[Key, Value]) GetOldest() (key Key, value Value, ok bool) + func (c *Cache[Key, Value]) Keys() []Key + func (c *Cache[Key, Value]) Len() int + func (c *Cache[Key, Value]) Peek(key Key) (value Value, ok bool) + func (c *Cache[Key, Value]) PeekOrAdd(key Key, value Value) (previous Value, ok, evicted bool) + func (c *Cache[Key, Value]) Purge() + func (c *Cache[Key, Value]) Remove(key Key) (present bool) + func (c *Cache[Key, Value]) RemoveOldest() (key Key, value Value, ok bool) + func (c *Cache[Key, Value]) Resize(size int) (evicted int) + type TwoQueueCache struct + func New2Q(size int) (*TwoQueueCache[Key, Value], error) + func New2QParams(size int, recentRatio, ghostRatio float64) (*TwoQueueCache[Key, Value], error) + func (c *TwoQueueCache[Key, Value]) Add(key Key, value Value) + func (c *TwoQueueCache[Key, Value]) Contains(key Key) bool + func (c *TwoQueueCache[Key, Value]) Get(key Key) (value Value, ok bool) + func (c *TwoQueueCache[Key, Value]) Keys() []Key + func (c *TwoQueueCache[Key, Value]) Len() int + func (c *TwoQueueCache[Key, Value]) Peek(key Key) (value Value, ok bool) + func (c *TwoQueueCache[Key, Value]) Purge() + func (c *TwoQueueCache[Key, Value]) Remove(key Key)