PCACHE.CONFIG
PCACHE.CONFIG namespace SET MAX_ENTRIES n PCACHE.CONFIG namespace SET TTL seconds PCACHE.CONFIG namespace SET COST_PER_HIT usd
- Group
- Prompt cache
- Complexity
- O(1), or O(N) when lowering MAX_ENTRIES evicts N entries
- Arity
- 5 (exactly, counting the command name)
- Flags
- write, fast
- Keys
- first 1, last 1, step 1
- HotKV Cloud
- Performance and Scale
- On-Premise
- requires the prompt-cache license feature
The prompt cache is an exact-match cache for LLM prompt and response pairs, organised in named namespaces. PCACHE.CONFIG changes one setting of an existing namespace at
runtime. The settings mean the same as in PCACHE.CREATE.
Options
Section titled “Options”| Option | Effect |
|---|---|
MAX_ENTRIES n |
New entry limit. 0 uses the server’s per-namespace limit, and larger values are capped at it. If the namespace holds more entries than the new limit, the excess is evicted immediately. |
TTL seconds |
New default TTL for entries stored afterwards without their own TTL. Entries already stored keep their expiry. 0 means no default. |
COST_PER_HIT usd |
New per-hit cost used for cost_saved_usd. Must be zero or positive. |
The option name is case-insensitive.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Setting changed | Simple string OK |
Same |
Errors:
ERR namespace not foundif the namespace does not exist.ERR invalid MAX_ENTRIES,ERR invalid TTLorERR invalid COST_PER_HITif the value cannot be parsed or is negative.ERR unknown optionfor any other option name.ERR wrong number of arguments for 'pcache.config' commandif the third argument is notSETor the argument count is not exactly five.NOLICENSE prompt-cache requires a HotKV license. Contact sales@hotkv.comif your license does not include theprompt-cachefeature.
Examples
Section titled “Examples”127.0.0.1:6379> PCACHE.CONFIG llm_prompts SET TTL 7200OK127.0.0.1:6379> PCACHE.CONFIG llm_prompts SET COST_PER_HIT 0.02OK127.0.0.1:6379> PCACHE.CONFIG missing SET TTL 60(error) ERR namespace not foundCompatibility
Section titled “Compatibility”HotKV-only command. Redis and Valkey have no equivalent.
See also
Section titled “See also”PCACHE.CREATE, PCACHE.SET, PCACHE.GET, PCACHE.GETEX, PCACHE.DEL, PCACHE.STATS, PCACHE.FLUSH, PCACHE.DROP, PCACHE.LIST, AI features guide
Was this page helpful?
Thanks for the feedback.