Versions in this module Expand all Collapse all v0 v0.1.0 Jun 1, 2022 Changes in this version + type Cache struct + func New(maxWeight uint, maxSize int) (*Cache, error) + func NewWithEvict(maxWeight uint, maxSize int, onEvict EvictCallback) (*Cache, error) + func (c *Cache) Add(key, value interface{}, weight uint) (evicted int) + func (c *Cache) Contains(key interface{}) (ok bool) + func (c *Cache) Get(key interface{}) (value interface{}, ok bool) + func (c *Cache) GetOldest() (key interface{}, value interface{}, ok bool) + func (c *Cache) Keys() []interface{} + func (c *Cache) Len() int + func (c *Cache) Peek(key interface{}) (value interface{}, ok bool) + func (c *Cache) Purge() + func (c *Cache) Remove(key interface{}) (present bool) + func (c *Cache) RemoveOldest() (key interface{}, value interface{}, ok bool) + func (c *Cache) Resize(maxWeight uint, maxSize int) (evicted int) + func (c *Cache) Total() (weight uint, num int) + func (c *Cache) Weight() uint + type EvictCallback func(key interface{}, value interface{})