Skip to main content

Module lru_cache

Module lru_cache 

Source
Expand description

High-performance LRU (Least Recently Used) cache with capacity management.

This module provides an arena-based doubly-linked-list LRU cache that avoids heap allocations per node by storing all nodes in a Vec<Option<LruNode>> and threading prev/next indices through them. Eviction, insertion, and lookup are all O(1) amortised.

Structsยง

CacheStats
Snapshot of cache statistics.
LruCache
High-performance LRU cache backed by an arena of Option<LruNode> slots.