CacheKit Docs

High-performance cache policies and supporting data structures.

View the Project on GitHub OxidizeLabs/cachekit

Intrusive Doubly-Linked List (O(1) Splice)

What It Is

An intrusive list stores prev/next pointers inside the node itself. This makes list operations O(1) without allocating wrapper list nodes.

Used for:

Core Types

You need:

Where Handle is one of:

Operations (Must Be O(1))

Invariants

Maintain these at all times:

Rust Implementation Notes

Pointer-based (NonNull<Node>)

Pros: direct, classic LRU design. Cons: unsafe invariants and lifetime management.

Index-based (usize/EntryId)

Pros: usually safe, cache-friendly, easier to test. Cons: requires a stable slot array.

Index-based is a good “generalized DS” because it composes cleanly with slot-arena.md.

Common Pitfalls

Testing Tips