Documentation
¶
Overview ¶
Package cache provides caching primitives for Hanzo Base, built on github.com/luxfi/cache. It re-exports the Cacher interface and LRU implementation, and adds a TTL wrapper for time-based expiration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cacher ¶
type Cacher[K comparable, V any] = lrucache.Cacher[K, V]
Cacher is the cache interface from luxfi/cache.
type TTL ¶
type TTL[K comparable, V any] struct { // contains filtered or unexported fields }
TTL wraps a Cacher and adds time-based expiration. Entries older than the configured TTL are evicted lazily on Get. Put resets the TTL.
The underlying cache controls eviction policy (e.g. LRU) and size bounds. TTL only adds the time dimension.
func (*TTL[K, V]) Get ¶
Get returns the value if it exists and has not expired. Expired entries are evicted immediately.
func (*TTL[K, V]) PortionFilled ¶
PortionFilled returns the fraction of the underlying cache that is occupied.