Versions in this module Expand all Collapse all v0 v0.0.2 Aug 13, 2022 v0.0.1 Aug 13, 2022 Changes in this version + const DefaultExpiration + const NoExpiration + func Seed() uint32 + type Cache interface + Add func(k string, x interface{}, d time.Duration) error + DecrementFloat func(k string, n float64) (interface{}, error) + DecrementInt func(k string, n int64) (interface{}, error) + Delete func(k string) + DeleteExpired func() + Flush func() + Get func(k string) (interface{}, bool) + GetWithExpiration func(k string) (interface{}, time.Time, bool) + IncrementFloat func(k string, n float64) (interface{}, error) + IncrementInt func(k string, n int64) (interface{}, error) + ItemCount func() int + Items func() map[string]Item + Replace func(k string, x interface{}, d time.Duration) error + Set func(k string, x interface{}, d time.Duration) + func New(opts ...Option) Cache + type DJB33Hasher struct + Seed uint32 + func (hasher *DJB33Hasher) Sum32(k string) uint32 + type Hash32 interface + Sum32 func(k string) uint32 + type Item struct + Expiration int64 + Object interface{} + func (item Item) Expired() bool + type MutexCache struct + func (c MutexCache) Add(k string, x interface{}, d time.Duration) error + func (c MutexCache) DecrementFloat(k string, n float64) (interface{}, error) + func (c MutexCache) DecrementInt(k string, n int64) (interface{}, error) + func (c MutexCache) Delete(k string) + func (c MutexCache) DeleteExpired() + func (c MutexCache) Flush() + func (c MutexCache) Get(k string) (interface{}, bool) + func (c MutexCache) GetWithExpiration(k string) (interface{}, time.Time, bool) + func (c MutexCache) IncrementFloat(k string, n float64) (interface{}, error) + func (c MutexCache) IncrementInt(k string, n int64) (interface{}, error) + func (c MutexCache) ItemCount() int + func (c MutexCache) Items() map[string]Item + func (c MutexCache) Load(r io.Reader) error + func (c MutexCache) LoadFile(fname string) error + func (c MutexCache) Replace(k string, x interface{}, d time.Duration) error + func (c MutexCache) Save(w io.Writer) (err error) + func (c MutexCache) SaveFile(fname string) error + func (c MutexCache) Set(k string, x interface{}, d time.Duration) + type Option func(o *options) + func CleanupInterval(interval time.Duration) Option + func ExpirationTime(expiration time.Duration) Option + func Hasher(hasher Hash32) Option + func OnEvicted(onEvicted func(string, interface{})) Option + func Shards(shards int) Option + type ShardedCache struct + func (sc ShardedCache) Add(k string, x interface{}, d time.Duration) error + func (sc ShardedCache) DecrementFloat(k string, n float64) (interface{}, error) + func (sc ShardedCache) DecrementInt(k string, n int64) (interface{}, error) + func (sc ShardedCache) Delete(k string) + func (sc ShardedCache) DeleteExpired() + func (sc ShardedCache) Flush() + func (sc ShardedCache) Get(k string) (interface{}, bool) + func (sc ShardedCache) GetWithExpiration(k string) (interface{}, time.Time, bool) + func (sc ShardedCache) IncrementFloat(k string, n float64) (interface{}, error) + func (sc ShardedCache) IncrementInt(k string, n int64) (interface{}, error) + func (sc ShardedCache) ItemCount() int + func (sc ShardedCache) Items() map[string]Item + func (sc ShardedCache) Replace(k string, x interface{}, d time.Duration) error + func (sc ShardedCache) Set(k string, x interface{}, d time.Duration)