Package Usage: go: github.com/go-pkgz/expirable-cache
Package cache implements Cache similar to hashicorp/golang-lru
Support LRC, LRU and TTL-based eviction.
Package is thread-safe and doesn't spawn any goroutines.
On every Set() call, cache deletes single oldest entry in case it's expired.
In case MaxSize is set, cache deletes the oldest entry disregarding its expiration date to maintain the size,
either using LRC or LRU eviction.
In case of default TTL (10 years) and default MaxSize (0, unlimited) the cache will be truly unlimited
and will never delete entries from itself automatically.
Important: only reliable way of not having expired entries stuck in a cache is to
run cache.DeleteExpired periodically using time.Ticker, advisable period is 1/2 of TTL.
5 versions
Latest release: almost 3 years ago
160 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/go-pkgz/expirable-cache