Structured extraction
Invoices and forms are turned into validated JSON. Re-processing the same document returns the validated result without another model call.
Replay answers that already passed your validators, and refuse repeat offenders without calling moderation or the model again.
The namespaces were made once with GUARD.CREATE and NCACHE.CREATE. The model produces JSON, and your validator checks it against the schema before anything is stored.
An animated walkthrough with real HotKV commands and example replies. Click any step to jump to it.
Structured output and safety checks are slow and cost money. There is a model call, a JSON schema validation, and maybe a second model to judge the answer. Repeated requests pay all of it again. And the same abusive prompt, sent a thousand times by a script, goes to moderation a thousand times.
The guard cache stores only responses that have already passed your schema validation or guardrail checks, so a hit is known to be safe to replay as is. The negative cache remembers refusals such as "refused by moderation" with a short TTL, so repeated bad requests are turned away before they reach the moderation service or the model.
The namespaces were made once with GUARD.CREATE and NCACHE.CREATE. The model produces JSON, and your validator checks it against the schema before anything is stored.
GUARD.SET validated "Summarize ticket 812 as JSON" "{\"summary\":\"Login fails on Safari\"}"The same request again. The stored answer already passed validation, so it is returned as is.
GUARD.GET validated "Summarize ticket 812 as JSON"A harmful prompt is refused. The refusal is remembered for five minutes.
NCACHE.SET refused "prompt:9f31c2" "refused_by_moderation" TTL 300The same prompt a moment later is turned away from the cache. Moderation and the model are not called.
NCACHE.GET refused "prompt:9f31c2"Each namespace reports hits, misses, evictions and memory.
GUARD.STATS validatedInvoices and forms are turned into validated JSON. Re-processing the same document returns the validated result without another model call.
Abuse scripts that hammer the same prompt are refused from the negative cache, keeping moderation costs flat.
"User not found" and other negative answers are cached briefly, so retries do not hit the backend.
Only responses that passed your checks are stored, so a hit is safe to replay.
GUARD.SETGUARD.GETRemember refusals and not-found results for a short time.
NCACHE.SETNCACHE.GETDefault TTLs and entry limits per namespace, with eviction when full.
GUARD.CREATENCACHE.CREATEHits, misses, evictions, memory and savings per namespace.
GUARD.STATSNCACHE.STATSNo. Your validator or guardrail decides. HotKV stores only what you put in the guard cache after it passed.
Usually briefly, minutes rather than days, so a policy change or a false positive does not stick. Set the TTL per namespace or per entry.
The guard cache and negative cache are part of the Performance and Scale plans.
HotKV speaks the Redis protocol, so you can point an existing client at it and run these same commands.