Versions in this module Expand all Collapse all v3 v3.0.0 Apr 28, 2024 Changes in this version + const DefaultExpiration + const NoExpiration + type Cache struct + func NewFrom[V any](defaultExpiration, cleanupInterval time.Duration, items map[string]Item[V]) *Cache[V] + func New[V any](defaultExpiration, cleanupInterval time.Duration) *Cache[V] + func (c Cache) Add(k string, x V, d time.Duration) error + func (c Cache) Delete(k string) + func (c Cache) DeleteExpired() + func (c Cache) Flush() + func (c Cache) Get(k string) (V, bool) + func (c Cache) GetWithExpiration(k string) (V, time.Time, bool) + func (c Cache) ItemCount() int + func (c Cache) Items() map[string]Item[V] + func (c Cache) OnEvicted(f func(string, V)) + func (c Cache) Replace(k string, x V, d time.Duration) error + func (c Cache) Set(k string, x V, d time.Duration) + func (c Cache) SetDefault(k string, x V) + type Item struct + Expiration int64 + Object V + func (item Item[V]) Expired() bool + type Number interface + type NumberCache struct + func NewNumberCache[T Number](defaultExpiration, cleanupInterval time.Duration) *NumberCache[T] + func (c *NumberCache[T]) Decrement(k string, n T) (T, error) + func (c *NumberCache[T]) Increment(k string, n T) (T, error) + func (c NumberCache) Add(k string, x V, d time.Duration) error + func (c NumberCache) Delete(k string) + func (c NumberCache) DeleteExpired() + func (c NumberCache) Flush() + func (c NumberCache) Get(k string) (V, bool) + func (c NumberCache) GetWithExpiration(k string) (V, time.Time, bool) + func (c NumberCache) ItemCount() int + func (c NumberCache) Items() map[string]Item[V] + func (c NumberCache) OnEvicted(f func(string, V)) + func (c NumberCache) Replace(k string, x V, d time.Duration) error + func (c NumberCache) Set(k string, x V, d time.Duration) + func (c NumberCache) SetDefault(k string, x V) Other modules containing this package github.com/barrett370/go-cache