CacheKit Docs

High-performance cache policies and supporting data structures.

View the Project on GitHub OxidizeLabs/cachekit

TTL / Time-Based Expiration

TTL is not a replacement policy; it’s an expiration rule that often coexists with an eviction policy.

Implementation Patterns

1) Lazy expiration on access

Store expires_at per entry.

Pros: no background work. Cons: expired entries can occupy space until touched.

2) Timer wheel / min-heap expiry

Maintain an expiration index:

Pros: can proactively free space. Cons: extra metadata and background/maintenance work.

Interaction With Eviction

When cache is full:

References