Versions in this module Expand all Collapse all v2 v2.1.0 May 26, 2022 Changes in this version type Cache + func (c Cache) Rename(src, dst K) bool v2.0.0 Mar 28, 2022 Changes in this version + const DefaultExpiration + const NoExpiration + type Cache struct + func New(defaultExpiration, cleanupInterval time.Duration) *Cache[K, V] + func NewFrom(defaultExpiration, cleanupInterval time.Duration, items map[K]Item[V]) *Cache[K, V] + func (c Cache) Add(k K, v V) error + func (c Cache) AddWithExpire(k K, v V, d time.Duration) error + func (c Cache) Delete(k K) + func (c Cache) DeleteAll() map[K]Item[V] + func (c Cache) DeleteExpired() + func (c Cache) DeleteFunc(filter func(key K, item Item[V]) (del, stop bool)) map[K]Item[V] + func (c Cache) Get(k K) (V, bool) + func (c Cache) GetStale(k K) (v V, expired bool, ok bool) + func (c Cache) GetWithExpire(k K) (V, time.Time, bool) + func (c Cache) ItemCount() int + func (c Cache) Items() map[K]Item[V] + func (c Cache) Keys() []K + func (c Cache) Modify(k K, f func(V) V) (V, bool) + func (c Cache) OnEvicted(f func(K, V)) + func (c Cache) Pop(k K) (V, bool) + func (c Cache) Replace(k K, v V) error + func (c Cache) ReplaceWithExpire(k K, v V, d time.Duration) error + func (c Cache) Reset() + func (c Cache) Set(k K, v V) + func (c Cache) SetWithExpire(k K, v V, d time.Duration) + func (c Cache) Touch(k K) (V, bool) + func (c Cache) TouchWithExpire(k K, d time.Duration) (V, bool) + type Item struct + Expiration int64 + Object V + type Proxy struct + func NewProxy(c *Cache[MainK, V]) *Proxy[ProxyK, MainK, V] + func (p *Proxy[ProxyK, MainK, V]) Cache() *Cache[MainK, V] + func (p *Proxy[ProxyK, MainK, V]) Delete(proxyKey ProxyK) + func (p *Proxy[ProxyK, MainK, V]) Get(proxyKey ProxyK) (V, bool) + func (p *Proxy[ProxyK, MainK, V]) Items() map[ProxyK]MainK + func (p *Proxy[ProxyK, MainK, V]) Key(proxyKey ProxyK) (MainK, bool) + func (p *Proxy[ProxyK, MainK, V]) Proxy(mainKey MainK, proxyKey ProxyK) + func (p *Proxy[ProxyK, MainK, V]) Reset() + func (p *Proxy[ProxyK, MainK, V]) Set(mainKey MainK, proxyKey ProxyK, v V) Other modules containing this package zgo.at/zcache