SCACHE.GET with a prompt like “Tell me about Go”, Cache-Pot can return a cached response originally stored for “What is Go?” — as long as the two prompts are semantically similar enough. This requires an embedding endpoint to be configured via the CACHEPOT_EMBED_URL environment variable.
Both
SCACHE.SET and SCACHE.GET call your configured embedding endpoint to vectorize the prompt text. If CACHEPOT_EMBED_URL is not set, both commands return an error. Cache-Pot stores semantic cache entries in an internal vector collection named __scache__, which is snapshotted and AOF-replayed like any other key.SCACHE.SET
Stores a prompt-response pair in the semantic cache. Cache-Pot calls your embedding endpoint to convert the prompt into a vector, then stores that vector alongside the response. Syntax:SCACHE.SET prompt response [TTL seconds]
The user query or input text to cache. This is vectorized via your embedding endpoint.
Optional expiry time in seconds. After this duration, the cached entry is treated as a miss and automatically evicted on next access. Omit this argument to cache the entry indefinitely.
OK on success.
When a TTL is specified, Cache-Pot stores the absolute expiry timestamp inside the entry’s metadata. The TTL is enforced lazily at read time by
SCACHE.GET, not by the key-expiry subsystem. This means the entry occupies memory until it is accessed and evicted. To proactively expire the underlying vector collection, use EXPIRE __scache__ <seconds> — but note that this evicts all semantic cache entries at once.SCACHE.GET
Retrieves a cached response by semantic similarity. Cache-Pot embeds the incoming prompt and searches the semantic cache for the closest stored prompt. If the best match meets or exceeds the similarity threshold, the associated response is returned; otherwisenil is returned.
Syntax: SCACHE.GET prompt [THRESHOLD x]
The query text to look up. Cache-Pot vectorizes this and performs a cosine similarity search against all stored prompts.
Minimum cosine similarity score (between
0.0 and 1.0) required to count as a cache hit. Defaults to 0.90. Lower values return more hits but risk returning responses to loosely related prompts.nil on a miss (no match above the threshold, an expired entry, or an empty cache).
Cache hits and misses are counted and surfaced in the
INFO output under # Stats (semantic_cache_hits, semantic_cache_misses, semantic_cache_hit_ratio) and on the built-in dashboard at http://localhost:8080.