Documentation
¶
Overview ¶
Package ttlcache provides passive, fixed-TTL LRU caches. It starts no goroutines and registers no asynchronous callbacks. This evaluation adapter is not used by production caches: synchronous expiration failed the latency gate.
Reads update LRU order without extending expiration. Expired entries are immediately unreadable, but their references remain until a write, Len, DeleteAll, or disposal. Finite capacities bound stored entry count; unlimited caches do not have a memory bound.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable, V any] struct { // contains filtered or unexported fields }
Cache is an experimental passive cache retained for migration benchmarks.
func New ¶
New creates a cache. Nonpositive capacity means unlimited; nonpositive TTL means no expiration, replacing expirable's ten-year sentinel.
func (*Cache[K, V]) DeleteAll ¶
func (c *Cache[K, V]) DeleteAll()
DeleteAll removes all retained entries.
func (*Cache[K, V]) Get ¶
Get returns a live value and promotes its LRU position without renewing TTL.
func (*Cache[K, V]) Has ¶
Has rejects expired entries without updating LRU order or expiration. Unlike expirable.Contains, it does not recognize retained expired entries.