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