Expand description
Multi-tier cache (L1 memory → L2 memory → disk).
Each tier has an independent EvictionPolicy and a byte-level capacity.
On a miss the implementation searches lower tiers in order; on a hit in a
lower tier the entry is promoted to L1.
§New in 0.1.2
- File-backed disk tier —
TierConfig::disk_pathenables a real file-backed tier backed by a directory on disk. Each cache key maps to a file inside that directory; reads and writes usestd::fs. - Adaptive promotion thresholds — each tier now tracks access
frequency per key. A hit in tier i only promotes to tier i-1 when
the key’s frequency exceeds the tier’s
promotion_threshold. This prevents scan pollution from one-shot accesses filling the hot tier. - Entry compression — tiers with
compress: truestore LZ4-style run-length encoding (pure Rust, no external deps) so that L2+ tiers occupy less memory / disk space.
§New in 0.1.8 Wave 13
- P² adaptive promotion — the promotion threshold can be auto-tuned
using a P² quantile estimator (Jain & Chlamtac 1985) that tracks the
75th-percentile of per-key access frequencies. Enable via
TieredCacheBuilder::enable_adaptive_promotion(true). - Arena allocation — when
use_arenais enabled, tier entry bytes are stored in aBumpArena(bump allocator) so theHashMapholds cheap(offset, len)handles instead of ownedVec<u8>.
Structs§
- Bump
Arena - A simple bump allocator for byte-slice entries.
- P2Quantile
Estimator - Online running estimator for an arbitrary quantile using the P² algorithm.
- Tier
Config - Configuration for one tier.
- Tier
Stats - Per-tier statistics snapshot.
- Tiered
Cache - A multi-tier cache where each tier has its own
TierConfig. - Tiered
Cache Stats - Aggregate statistics snapshot for the whole
TieredCache.
Enums§
- Eviction
Policy - Eviction strategy for a single cache tier.