cache_set
Store a key-value pair in a running cache instance, overwriting any existing value. Accepts strings or JSON objects, with an optional TTL in seconds. Returns "OK" on success or an error if the instance is invalid or paused.
Instructions
Set a key-value pair in a running cache instance. Overwrites any existing value at the key — not idempotent for new data. Returns "OK" on success; returns an error if the instance_id is invalid or the instance is paused. Value can be a string or a JSON-serialized object. Optionally set a TTL in seconds (omit for no expiry). Use cache_mset instead for setting multiple keys in a single pipeline round-trip. Use cache_stream_set instead for caching LLM token streams (ordered string chunks).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Cache key | |
| ttl | No | Time-to-live in seconds (optional, omit for no expiry) | |
| value | Yes | Value to store (string or JSON) | |
| org_id | No | Optional org ID — also writes the key to the shared org namespace org:{org_id}:sem:{key} with the same TTL | |
| instance_id | Yes | UUID of the cache instance (from list_instances) |