REMEMBER and RECALL commands give AI agents a simple key-value memory store scoped to a named session. Use them to persist facts, user preferences, conversation state, or any structured context that needs to survive across multiple turns or requests. Memory is stored in a Cache-Pot hash at the key mem:<session>, so it inherits all standard hash and TTL behavior. These commands are also exposed as native MCP tools, meaning an agent running against Cache-Pot’s MCP endpoint can call them directly without writing any Redis client code.
REMEMBER
Stores a value in a session’s memory under a named field. If the field already exists, its value is overwritten. Syntax:REMEMBER session field value
A unique session identifier — for example, a user ID, conversation ID, or request correlation ID. Cache-Pot namespaces all memory for this session under the hash key
mem:<session>.The memory key within this session. Use descriptive names like
name, last_topic, or turn_count to keep sessions readable.The value to store. All values are stored as strings; serialize structured data (JSON, etc.) before storing if needed.
OK.
REMEMBER session field value is exactly equivalent to HSET mem:session field value. You can mix REMEMBER with direct hash commands on the same mem:<session> key — they operate on the same underlying data.RECALL
Retrieves memory for a session. Provide a field name to fetch a single value, or omit it to return the entire session as a flat array of field-value pairs. Syntax:RECALL session [field]
Optional. The specific memory field to retrieve. When omitted, all fields and values for the session are returned.
nil if the field does not exist. Returns a flat array of alternating field names and values when no field is given — identical to the output of HGETALL mem:<session>.
A flat array of
[field, value, field, value, ...] pairs for the entire session. Returns an empty array if the session does not exist.Setting expiry on session memory
Session memory is stored at the standard Cache-Pot keymem:<session>. Use the regular expiry commands to set a time-to-live on an entire session — for example, to auto-expire memory after a period of inactivity.
Using hash commands directly
REMEMBER and RECALL are thin convenience wrappers over the standard hash commands. You can use any hash command directly on mem:<session> for operations that REMEMBER/RECALL don’t cover:
Because
REMEMBER and RECALL are sugar over HSET/HGET/HGETALL on mem:<session>, any change made through hash commands is immediately visible through RECALL, and vice versa.