Skip to main content

Crate cache_mod

Crate cache_mod 

Source
Expand description

§cache-mod

HIGH-PERFORMANCE IN-PROCESS CACHING

Multiple eviction policies (LRU, LFU, TinyLFU, TTL, size-bounded). Async-safe, lock-minimized internals. Typed key-value API. No external store dependency.

§Status

Foundation milestone (0.2.0). The public API surface is defined: the Cache trait, the LruCache reference implementation, and the CacheError error type. LFU, TinyLFU, TTL, and size-bounded eviction policies land in subsequent minors. The API is not yet frozen — pin exact versions until 1.0.

§Quick start

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);

§License

Dual-licensed under Apache-2.0 OR MIT.

Structs§

LruCachestd
A bounded, thread-safe LRU cache.

Enums§

CacheError
Errors produced by cache-mod.

Constants§

VERSION
Crate version string, populated by Cargo at build time.

Traits§

Cache
The common read / write / evict contract every cache type in this crate implements.