Announcing cachekit 0.7 โ€” pluggable cache policies and arena-backed primitives

โš“ Rust    ๐Ÿ“… 2026-04-09    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 5      

surdeus

Hi everyone,

Iโ€™d like to share cachekit, a Rust library for high-performance in-memory caches with many eviction policies, a unified builder API, and low-allocation hot paths aimed at predictable behavior under skewed and scan-heavy workloads.

What you get

  • 18 eviction policies behind policy-* feature flags (e.g. LRU, Fast-LRU, LRU-K, LFU, 2Q, S3-FIFO, ARC, CAR, SLRU, Clock, Clock-PRO, and more). Defaults are a small subset; use policy-all or cherry-pick with default-features = false for smaller builds.
  • CacheBuilder for a single entry point, plus concrete policy types when you need policy-specific knobs.
  • Trait-based surface (Cache plus optional capability traits for eviction inspection, recency/frequency/history where applicable).
  • ds module: reusable arena, ring buffers, intrusive lists, ghost lists, frequency buckets, etc. โ€” intended for pre-allocated, index-heavy layouts rather than per-op allocation.
  • Optional metrics (hit/miss/eviction counters) and concurrency (parking_lot-backed concurrent building blocks).

Quick start

use cachekit::builder::{CacheBuilder, CachePolicy};

let mut cache = CacheBuilder::new(1000).build::<u64, String>(CachePolicy::Lru);
cache.insert(1, "hello".to_string());
assert_eq!(cache.get(&1), Some(&"hello".to_string()));

Links

Feedback, issue reports, and real-world workload stories are very welcome โ€” especially if youโ€™re comparing policies or care about tail latency under scans.

Thanks for reading!

1 post - 1 participant

Read full topic

๐Ÿท๏ธ Rust_feed