Versions in this module Expand all Collapse all v0 v0.1.0 Jun 23, 2025 Changes in this version + type Config struct + func NewConfig[V any]() *Config[V] + type ExpiredCallback func(k string, v V) error + type ICache interface + Clear func() + Del func(keys ...string) int + DelExpired func(k string) bool + Exists func(keys ...string) bool + Expire func(k string, d time.Duration) bool + ExpireAt func(k string, t time.Time) bool + Get func(k string) (T, bool) + GetDel func(k string) (T, bool) + GetSet func(k string, v T, opts ...SetIOption[T]) (T, bool) + Persist func(k string) bool + Set func(k string, v T, opts ...SetIOption[T]) bool + Ttl func(k string) (time.Duration, bool) + func NewMemCache[V any](opts ...ICacheOption[V]) ICache[V] + type ICacheOption func(conf *Config[V]) + func WithClearInterval[V any](d time.Duration) ICacheOption[V] + func WithExpiredCallback[V any](ec ExpiredCallback[V]) ICacheOption[V] + func WithHash[V any](hash IHash) ICacheOption[V] + func WithShards[V any](shards int) ICacheOption[V] + type IHash interface + Sum64 func(string) uint64 + type IItem interface + CanExpire func() bool + Expired func() bool + SetExpireAt func(t time.Time) + type Item struct + func (i *Item[V]) CanExpire() bool + func (i *Item[V]) Expired() bool + func (i *Item[V]) SetExpireAt(t time.Time) + type MemCache struct + func (c MemCache) Clear() + func (c MemCache) Del(ks ...string) int + func (c MemCache) DelExpired(k string) bool + func (c MemCache) Exists(ks ...string) bool + func (c MemCache) Expire(k string, d time.Duration) bool + func (c MemCache) ExpireAt(k string, t time.Time) bool + func (c MemCache) Get(k string) (V, bool) + func (c MemCache) GetDel(k string) (V, bool) + func (c MemCache) GetSet(k string, v V, opts ...SetIOption[V]) (V, bool) + func (c MemCache) Persist(k string) bool + func (c MemCache) Set(k string, v V, opts ...SetIOption[V]) bool + func (c MemCache) Ttl(k string) (time.Duration, bool) + type SetIOption func(ICache[V], string, IItem) bool + func WithExAt[V any](t time.Time) SetIOption[V] + func WithEx[V any](d time.Duration) SetIOption[V]