Versions in this module Expand all Collapse all v1 v1.2.0 Sep 19, 2023 Changes in this version + const DefaultExpiration + const NoExpiration + type Cache struct + func New(options ...Option) *Cache[T] + func (c Cache) Add(k string, x T, d time.Duration) error + func (c Cache) Decrement(k string, n int64) error + func (c Cache) DecrementFloat(k string, n float64) error + func (c Cache) DecrementFloat32(k string, n float32) (float32, error) + func (c Cache) DecrementFloat64(k string, n float64) (float64, error) + func (c Cache) DecrementInt(k string, n int) (int, error) + func (c Cache) DecrementInt16(k string, n int16) (int16, error) + func (c Cache) DecrementInt32(k string, n int32) (int32, error) + func (c Cache) DecrementInt64(k string, n int64) (int64, error) + func (c Cache) DecrementInt8(k string, n int8) (int8, error) + func (c Cache) DecrementUint(k string, n uint) (uint, error) + func (c Cache) DecrementUint16(k string, n uint16) (uint16, error) + func (c Cache) DecrementUint32(k string, n uint32) (uint32, error) + func (c Cache) DecrementUint64(k string, n uint64) (uint64, error) + func (c Cache) DecrementUint8(k string, n uint8) (uint8, error) + func (c Cache) DecrementUintptr(k string, n uintptr) (uintptr, error) + func (c Cache) Delete(k string) + func (c Cache) DeleteExpired() + func (c Cache) Flush() + func (c Cache) Get(k string) (r T, ok bool) + func (c Cache) GetWithExpiration(k string) (r interface{}, t time.Time, ok bool) + func (c Cache) Increment(k string, n int64) error + func (c Cache) IncrementFloat(k string, n float64) error + func (c Cache) IncrementFloat32(k string, n float32) (float32, error) + func (c Cache) IncrementFloat64(k string, n float64) (float64, error) + func (c Cache) IncrementInt(k string, n int) (int, error) + func (c Cache) IncrementInt16(k string, n int16) (int16, error) + func (c Cache) IncrementInt32(k string, n int32) (int32, error) + func (c Cache) IncrementInt64(k string, n int64) (int64, error) + func (c Cache) IncrementInt8(k string, n int8) (int8, error) + func (c Cache) IncrementUint(k string, n uint) (uint, error) + func (c Cache) IncrementUint16(k string, n uint16) (uint16, error) + func (c Cache) IncrementUint32(k string, n uint32) (uint32, error) + func (c Cache) IncrementUint64(k string, n uint64) (uint64, error) + func (c Cache) IncrementUint8(k string, n uint8) (uint8, error) + func (c Cache) IncrementUintptr(k string, n uintptr) (uintptr, error) + func (c Cache) ItemCount() int + func (c Cache) Items() map[string]Item[T] + func (c Cache) Load(r io.Reader) error + func (c Cache) LoadFile(filename string) error + func (c Cache) OnEvicted(f func(string, interface{})) + func (c Cache) Replace(k string, x T, d time.Duration) error + func (c Cache) Save(w io.Writer) (err error) + func (c Cache) SaveFile(fname string) error + func (c Cache) Set(k string, x T, d time.Duration) + func (c Cache) SetDefault(k string, x T) + type Item struct + Expiration int64 + Object T + func (item Item[T]) Expired() bool + type Option func(c *config) + func WithCleanupInterval(cleanupInterval time.Duration) Option + func WithDefaultExpiration(defaultExpiration time.Duration) Option + func WithItems(items map[string]Item[T]) Option