High-performance cache policies and supporting data structures.
This store module is implemented in cachekit::store::hashmap and provides HashMap-backed stores with entry-count capacity enforcement.
HashMap<K, Arc<V>>.len() <= capacity()), not by bytes.HashMapStore<K, V>: single-threaded store.ConcurrentHashMapStore<K, V>: RwLock-protected store for multi-threaded use.ShardedHashMapStore<K, V>: per-shard locks to reduce contention.try_insert: insert/update by key; fails with StoreFull when at capacity.get: fetch by key (updates hit/miss counters).remove, clear, contains, len.Arc<V>; clones are cheap on reads, but inserts still allocate the Arc.use std::sync::Arc;
use cachekit::store::hashmap::HashMapStore;
use cachekit::store::traits::StoreMut;
let mut store: HashMapStore<u64, String> = HashMapStore::new(2);
store.try_insert(1, Arc::new("a".to_string())).unwrap();
assert!(store.contains(&1));
K: Eq + Hash for key lookup.HashMapStore is single-threaded.ConcurrentHashMapStore and ShardedHashMapStore are Send + Sync.