High-performance cache policies and supporting data structures.
Spec maturity: reference
Executable oracle:
tests/abstract_models/exact/mfu.rs(MfuModel); independent reference:reference/mfu.rs(NaiveMfuModel).
Most Frequently Used cache replacement: evict the key with maximum frequency when space is needed.
| Variable | Type | Meaning |
|---|---|---|
freq |
Map<K, ℕ> |
Live frequency per resident key |
heap |
max-heap with sequence numbers | Stale entries possible |
capacity |
usize |
Maximum resident count |
freq = ∅, capacity = C| Observable | Definition |
|---|---|
resident |
Keys in freq |
peek_victim |
Max frequency; highest sequence number at ties (newest heap entry) |
hit |
MustHit / MustMiss |
Insert(k)k ∈ resident: increment frequency.evicted_on_insert.Get(k) / Peek(k)hit. Get increments on hit.Remove(k) / EvictOnedebug_validate_invariants when keys are removed outside insert/evict path.standard_op_list_mfu_safe (no Remove / EvictOne in traces).