Versions in this module Expand all Collapse all v1 v1.0.1 Jan 9, 2023 Changes in this version + const DefaultExpiration + const NoExpiration + type Cache struct + func New(defaultExpiration, cleanupInterval time.Duration) *Cache[K, T] + func NewFrom(defaultExpiration, cleanupInterval time.Duration, items map[K]Item[T]) *Cache[K, T] + func (c Cache) Add(k K, x T, d time.Duration) error + func (c Cache) Delete(k K) + func (c Cache) DeleteExpired() + func (c Cache) Flush() + func (c Cache) Get(k K) (T, bool) + func (c Cache) GetWithExpiration(k K) (T, time.Time, bool) + func (c Cache) ItemCount() int + func (c Cache) Items() map[K]Item[T] + func (c Cache) Load(r io.Reader) error + func (c Cache) LoadFile(fname string) error + func (c Cache) OnEvicted(f func(K, T)) + func (c Cache) Replace(k K, 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 K, x T, d time.Duration) + func (c Cache) SetDefault(k K, x T) + type Item struct + Expiration int64 + Object T + func (item Item[T]) Expired() bool