High-performance cache policies and supporting data structures.
This store module is implemented in cachekit::store::handle and provides a store keyed by compact handles (IDs) instead of full keys. It’s intended to be used alongside a KeyInterner (or any other handle allocator) so that policy metadata never has to clone large keys.
HashMap<H, Arc<V>>, where H is a compact handle type.HandleStore<H, V>: single-threaded handle-backed store.ConcurrentHandleStore<H, V>: RwLock-protected store for multi-threaded use.KeyInterner: a common way to obtain stable handles for keys (in cachekit::ds).try_insert: insert/update by handle.get: fetch by handle (updates hit/miss counters).remove, clear.Arc<V> values for cheap cloning on reads.use std::sync::Arc;
use cachekit::ds::KeyInterner;
use cachekit::store::handle::HandleStore;
use cachekit::store::traits::StoreMut;
let mut interner = KeyInterner::new();
let handle = interner.intern("alpha".to_string());
let mut store: HandleStore<_, String> = HandleStore::new(2);
store.try_insert(handle, Arc::new("value".to_string())).unwrap();
H: Copy + Eq + Hash for handle lookup.HandleStore is single-threaded.ConcurrentHandleStore is Send + Sync via RwLock.