CacheKit Docs

High-performance cache policies and supporting data structures.

View the Project on GitHub OxidizeLabs/cachekit

2Q operational spec

Spec maturity: stub

Executable oracle: tests/abstract_models/exact/two_q.rs (TwoQModel) — mirrors TwoQCore until an independent reference/ model exists.

2Q: two queues (probation A1 and protected Am); new keys enter probation; re-access promotes to protected; evict LRU from probation.

State

Variable Type Meaning
probation Seq<K> A1 queue — head = newest, tail = LRU (eviction victim)
protected Seq<K> Am queue — head = MRU, tail = LRU
queues Map<K, {Probation, Protected}> Per-key queue membership
probation_cap usize Max probation size
protected_cap usize Max protected size

Init

Observables

Observable Definition
resident Keys in either queue
hit MustHit / MustMiss

Operations

Insert(k) (new key)

Get(k) / Peek(k)

Remove(k)

Harness notes

References