Versions in this module Expand all Collapse all v0 v0.0.1 Nov 25, 2022 Changes in this version + type Cache struct + Options Options + func New(options ...Options) *Cache[T] + func (c *Cache[T]) Close() + func (c *Cache[T]) Contains(key string) bool + func (c *Cache[T]) Delete(key string) + func (c *Cache[T]) EnableAutoPurge(purgeInterval ...time.Duration) *Cache[T] + func (c *Cache[T]) Expired(key string) bool + func (c *Cache[T]) Get(key string) T + func (c *Cache[T]) GetEntry(key string) *Entry[T] + func (c *Cache[T]) GetExpiration(key string) time.Duration + func (c *Cache[T]) GetOrSet(key string, callback func() T, expiration ...time.Duration) T + func (c *Cache[T]) Keys() []string + func (c *Cache[T]) Purge() + func (c *Cache[T]) PurgeExpired() + func (c *Cache[T]) Set(key string, value T, expiration ...time.Duration) + func (c *Cache[T]) SetExpiration(expiration time.Duration) + func (c *Cache[T]) Size() int + func (c *Cache[T]) StopAutoPurge() + func (c *Cache[T]) ValidKeys() []string + func (c *Cache[T]) ValidSize() int + func (c *Cache[T]) Values() []T + type Entry struct + CachedAt time.Time + Expiration time.Duration + Value T + func (e *Entry[T]) SetExpiration(expiration time.Duration) + func (e Entry[T]) Expired() bool + type Options struct + AutoPurgeInterval time.Duration + DefaultExpiration time.Duration