INVALIDATE WHERE intent='user pricing' CONFIDENCE 0.9 — the cache uses its built-in vector index to find all semantically related keys. No more KEYS user:123:* hoping you got the right pattern.
Every team that has ever typed KEYS user:123:* into a Redis console knows the feeling: did I get everything? Did I get too much? Pattern invalidation is a lexicographic operation applied to a semantic problem.
KEYS user:123:* finds user:123:profile but misses user:123:dashboard:v2 if the schema changed. It also misses pricing:tier:enterprise even though that key is semantically related to user 123's billing. String matching cannot understand relationships between concepts.user:123:*, accept the hit rate drop, recompute everything. This is safe but expensive — you are paying for cache misses on keys that were perfectly fresh because you could not tell them apart from the stale ones.Every cache key gets a lightweight semantic embedding, computed at SET time or on first access. When you issue an INVALIDATE WHERE command, the cache embeds the intent query, searches the vector index for keys above the confidence threshold, and invalidates only those. The operator controls precision.
Every cache key receives a lightweight semantic embedding when it is written. The embedding is computed asynchronously after the SET completes, adding zero latency to the write path. Key names, value schemas, and optional metadata are all factored into the embedding. The result is stored in the same HNSW vector index that powers Cachee's VSEARCH command.
For keys that already exist (migration scenarios), embeddings are computed lazily on first access. The vector index builds incrementally, with no bulk reindexing required.
The CONFIDENCE parameter is the operator's precision dial. High confidence (0.95) means only keys with very strong semantic similarity are invalidated — safe for production, surgical, minimal blast radius. Lower confidence (0.7) casts a wider net, useful for development, debugging, or broad category invalidation like “anything related to billing.”
Every INVALIDATE WHERE command returns the list of matched keys and their similarity scores, so you can audit exactly what was invalidated and tune the threshold. There is no opaque AI making decisions — you see every score, every match, every skip.
Semantic invalidation fills the gap between “I know the exact key” and “I need to invalidate a concept.” Every method has a use case. The right tool depends on what you know at invalidation time.
| Method | Command | Best When | Weakness |
|---|---|---|---|
| Exact Key | DEL user:123:profile | You know the exact key name | Only one key at a time |
| Pattern | KEYS user:123:* / SCAN | Keys share a predictable prefix | Misses differently-named related keys; O(N) scan |
| CDC | Automatic (DB trigger) | Cache keys map directly to DB rows | Does not handle key-to-key relationships |
| Dependency Graph | DEPENDS_ON (DAG cascade) | Known, explicit key-to-key dependencies | Requires declaring dependencies at write time |
| Semantic | INVALIDATE WHERE intent=... | You know what changed conceptually but not which keys | Requires vector index; confidence tuning |
Semantic invalidation is not a standalone feature. It multiplies the power of every other Cachee primitive, creating invalidation strategies that no other system can replicate.
INVALIDATE WHERE intent="billing changes" finds the source key billing:plan:enterprise, and the graph automatically cascades to every dashboard, report, and composite that depends on it.pricing table triggers CDC for the base key, and a semantic rule catches every pricing-related key across every naming convention.Learn more about causal dependency graphs, CDC auto-invalidation, and cross-service coherence.
Semantic cache invalidation uses vector embeddings to find and invalidate cache keys by meaning rather than by string pattern. Instead of running KEYS user:123:* and hoping the pattern matches all relevant keys, you issue INVALIDATE WHERE intent='user 123 pricing data' CONFIDENCE 0.9 and the cache uses its built-in vector index to find every key whose semantic embedding exceeds the 90% similarity threshold. This eliminates both over-invalidation and under-invalidation.
The CONFIDENCE parameter controls the precision-recall tradeoff. A high threshold like 0.95 means only keys with greater than 95% semantic similarity are invalidated — surgical, safe for production. A lower threshold like 0.7 casts a wider net, catching tangentially related keys — useful for development or broad category invalidation. The operator controls the threshold per command. Every command returns the matched keys with their similarity scores for full auditability.
Semantic embeddings are computed asynchronously after the SET completes, adding zero latency to the write path. The embedding is stored in the same HNSW vector index that powers Cachee's VSEARCH command. Read-path GET operations are completely unaffected. The only latency cost is on the invalidation path itself — the VSEARCH query that finds semantically related keys — which completes in sub-millisecond time for typical cache sizes.
Yes. CDC auto-invalidation and semantic invalidation compose naturally. CDC watches your database change stream and invalidates base cache keys when rows change. Semantic invalidation handles the keys that CDC cannot reach — keys that are semantically related to the changed data but not directly mapped to a database table. Together, CDC covers the database-to-cache mapping and semantic covers the concept-to-cache mapping.
Yes, when used with appropriate confidence thresholds. A CONFIDENCE of 0.9 or higher provides surgical invalidation that only touches keys with strong semantic similarity. There is no black-box AI making decisions — you see every similarity score, every match, every skip. For critical production paths, use CONFIDENCE 0.95 for maximum precision. The vector index uses the same battle-tested HNSW implementation that powers Cachee's VSEARCH command.
One INVALIDATE WHERE command replaces pattern matching, invalidation maps, and nuclear prefix flushes. Describe the intent. Set your confidence. Ship.