CacheKit Docs

High-performance cache policies and supporting data structures.

View the Project on GitHub OxidizeLabs/cachekit

LRU (Least Recently Used)

Feature: policy-lru

Goal

Evict the entry that has not been accessed for the longest time.

Core Data Structures

src/policy/lru.rs uses a pool-based design:

At steady state (cache full), every insert evicts the tail node (returning its slot to the free list) then inserts the new node (reusing a free slot). No heap allocations occur after the initial warm-up phase.

Operations

get(key)

insert(key, value)

pop_lru()

peek(key) / peek_lru()

Complexity & Overhead

Concurrency Notes

Strict global LRU mutates shared metadata on every hit; cachekit provides:

Safety / Invariants (Rust)

References