Memo::QueryCache
LRU query embedding cache with optional DB persistence.
Avoids repeated API calls for the same query text by caching the embedding vector. Memory LRU is checked first (instant), then DB (fast), then API (slow).
Memory is bounded by max_entries (LRU eviction). DB is bounded by max_db_entries (oldest evicted on prune).
Constructors
new(max_entries : Int32 = 10000, max_db_entries : Int32 = 100000, db : DB::Database | Nil = nil, service_id : Int64 = 0)
SourceInstance methods
Look up a cached embedding for a query string. Returns {embedding, token_count} or nil on miss.
hits
Sourcemax_db_entries
Sourcemax_entries
Sourcemisses
SourceStore an embedding for a query string.