HnswStore
An in-process CacheStore that scales past the exact-scan dev.kmemo.store.InMemoryStore with an approximate-nearest-neighbour (HNSW) index, while staying pure Kotlin with no extra dependency.
Correctness is not approximate. The HNSW graph only proposes candidates; this store then rescores them exactly with Vectors.dot and applies scope and TTL from an authoritative map, so liveness, expiry, size, remove and replacement are exact. Approximation costs only recall — a true nearest neighbour is occasionally missed — which is why the exact store stays the reference and why this one is opt-in, for caches large enough that an O(n) scan per lookup hurts.
Stale graph nodes (from removals and replacements) are filtered on read and periodically compacted by rebuilding a scope's index once they dominate it.
Safe across coroutines and threads: every operation takes a mutex, as in dev.kmemo.store.InMemoryStore.