Versions in this module Expand all Collapse all v0 v0.0.1 Aug 8, 2023 Changes in this version + type Cache struct + Metrics *Metrics + func NewCache(config *Config[K, V]) (*Cache[K, V], error) + func (c *Cache[K, V]) Clear() + func (c *Cache[K, V]) Close() + func (c *Cache[K, V]) Del(key K) + func (c *Cache[K, V]) Get(key K) (V, bool) + func (c *Cache[K, V]) GetTTL(key K) (time.Duration, bool) + func (c *Cache[K, V]) MaxCost() int64 + func (c *Cache[K, V]) Set(key K, value V, cost int64) bool + func (c *Cache[K, V]) SetWithTTL(key K, value V, cost int64, ttl time.Duration) bool + func (c *Cache[K, V]) UpdateMaxCost(maxCost int64) + func (c *Cache[K, V]) Wait() + type Config struct + BufferItems int64 + Cost func(value V) int64 + IgnoreInternalCost bool + KeyToHash func(key K) (uint64, uint64) + MaxCost int64 + Metrics bool + NumCounters int64 + OnEvict func(item *Item[V]) + OnExit func(val V) + OnReject func(item *Item[V]) + type Item struct + Conflict uint64 + Cost int64 + Expiration time.Time + Key uint64 + Value V + type Metrics struct + func (p *Metrics) Clear() + func (p *Metrics) CostAdded() uint64 + func (p *Metrics) CostEvicted() uint64 + func (p *Metrics) GetsDropped() uint64 + func (p *Metrics) GetsKept() uint64 + func (p *Metrics) Hits() uint64 + func (p *Metrics) KeysAdded() uint64 + func (p *Metrics) KeysEvicted() uint64 + func (p *Metrics) KeysUpdated() uint64 + func (p *Metrics) LifeExpectancySeconds() *z.HistogramData + func (p *Metrics) Misses() uint64 + func (p *Metrics) Ratio() float64 + func (p *Metrics) SetsDropped() uint64 + func (p *Metrics) SetsRejected() uint64 + func (p *Metrics) String() string