cache-mod 0.2.0

High-performance in-process caching with multiple eviction policies (LRU, LFU, TinyLFU, TTL, size-bounded). Async-safe, lock-minimized internals. Typed key-value API. No dependency on any external store.
Documentation

Status

Active development. Foundation milestone (0.2.0) shipped. On the path to 1.0.

The public API is not yet frozen. Pin specific versions; expect additive (and occasionally breaking) changes pre-1.0.


What it does

High-performance in-process caching with multiple eviction policies (LRU, LFU, TinyLFU, TTL, size-bounded). Async-safe, lock-minimized internals. Typed key-value API. No dependency on any external store.


Quick start

[dependencies]
cache-mod = "0.2"
use cache_mod::{Cache, LruCache};

let cache: LruCache<&'static str, u32> = LruCache::new(64).expect("capacity > 0");

cache.insert("requests", 1);
cache.insert("errors", 0);

assert_eq!(cache.get(&"requests"), Some(1));
assert_eq!(cache.len(), 2);

What's shipped

  • Cache<K, V> trait — the common read / write / evict contract.
  • LruCache<K, V> — bounded, thread-safe Least-Recently-Used cache.
  • CacheError — error type returned by constructors.

LFU, TinyLFU, TTL, and size-bounded variants land in subsequent minors. The lock-free, arena-backed LruCache rewrite lands in 0.5.0 without changing the public surface.


Standards

  • REPS governs every decision. See REPS.md.
  • MSRV: Rust 1.75.
  • Edition: 2024.
  • Cross-platform: Linux, macOS, Windows.

License

Dual-licensed under either of:

at your option.