Versions in this module Expand all Collapse all v4 v4.7.1 Feb 23, 2023 Changes in this version + var DefaultCache Cache = NewCache() + var DefaultExpiration time.Duration = 0 + var ErrItemExpired error = errors.New("item has expired") + var ErrKeyNotFound error = errors.New("key not found in cache") + type Cache interface + Context func(ctx context.Context) Cache + Delete func(key string) error + Get func(key string) (interface{}, time.Time, error) + Put func(key string, val interface{}, d time.Duration) error + func NewCache(opts ...Option) Cache + type Item struct + Expiration int64 + Value interface{} + func (i *Item) Expired() bool + type Option func(o *Options) + func Expiration(d time.Duration) Option + func Items(i map[string]Item) Option + type Options struct + Expiration time.Duration + Items map[string]Item + func NewOptions(opts ...Option) Options