Add persistent SQLite metadata storage and persistent HNSWLib vector DB#95
Merged
luis-gasparschroeder merged 3 commits intoJul 18, 2026
Conversation
Adds two opt-in, drop-in strategy implementations so the cache can survive process restarts: SQLiteEmbeddingMetadataStorage persists metadata to a SQLite file, and PersistentHNSWLibVectorDB persists its hnswlib index plus a small bookkeeping sidecar to disk. Existing defaults (in-memory storage, non-persistent HNSWLib) are unchanged.
Contributor
Author
luis-gasparschroeder
previously approved these changes
Jul 16, 2026
luis-gasparschroeder
left a comment
Collaborator
There was a problem hiding this comment.
Thank you for contributing to vCache! The SQLite extension makes sense; regarding persistent HNSWLib, a future PR should make index and metadata writes atomic and avoid rewriting the entire index after every mutation, as crashes or concurrent processes can otherwise corrupt or desynchronize the stored data.
Collaborator
|
@Safaael25, please run the poetry ruff formatter, push the changes, and the PR is good to be merged. |
luis-gasparschroeder
approved these changes
Jul 17, 2026
luis-gasparschroeder
left a comment
Collaborator
There was a problem hiding this comment.
Looks good, thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
description
SQLiteEmbeddingMetadataStorage, a drop-inEmbeddingMetadataStoragethat persists metadata to a SQLite file (pickled per row, keyed by
embedding_id) instead of only living in memory.PersistentHNSWLibVectorDB, a standaloneVectorDBimplementationthat persists its hnswlib index plus a small JSON bookkeeping sidecar to
disk, so the vector index survives process restarts.
VCacheConfigdefaults (InMemoryEmbeddingMetadataStorage,HNSWLibVectorDB) are unchanged — no existing behavior is affected.Why?
The cache is currently entirely in-memory: every restart/redeploy/crash
throws away both the cached responses and the per-embedding learning state
(observations, thresholds) that
VerifiedDecisionPolicybuilds up overtime. This adds an opt-in path to make that durable.
Test plan
tests (write via one instance, reopen a fresh instance on the same
path, confirm data survives)
EmbeddingMetadataStrategy/VectorDBStrategysuites still pass