Announcing cachekit 0.7 — pluggable cache policies and arena-backed primitives

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!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.