Memory Cache
Standardized Redis-backed caching system for OpenClaw agents.
Prerequisites
- - Binary:
python3 must be available on the host. - Credentials:
REDIS_URL environment variable (e.g., redis://localhost:6379/0).
Setup
- 1. Copy
env.example.txt to .env. - Configure your connection in
.env. - Dependencies are listed in
requirements.txt.
Core Workflows
1. Store and Retrieve
- - Store: INLINECODE7
- Fetch: INLINECODE8
2. Search & Maintenance
- - Scan: INLINECODE9
- Ping: INLINECODE10
Key Naming Convention
Strictly enforce the
mema: prefix:
- -
mema:context:* – Session state. - INLINECODE13 – Volatile data.
- INLINECODE14 – Persistent state.
内存缓存
为OpenClaw智能体提供的标准化Redis后端缓存系统。
前置条件
- - 二进制文件:主机上必须安装python3。
- 凭证:REDIS_URL环境变量(例如redis://localhost:6379/0)。
设置
- 1. 将env.example.txt复制为.env。
- 在.env中配置您的连接。
- 依赖项列在requirements.txt中。
核心工作流程
1. 存储与检索
- - 存储:python3 $WORKSPACE/skills/memory-cache/scripts/cachemanager.py set mema:cache:<名称> <值> [--ttl 3600]
- 获取:python3 $WORKSPACE/skills/memory-cache/scripts/cachemanager.py get mema:cache:<名称>
2. 搜索与维护
- - 扫描:python3 $WORKSPACE/skills/memory-cache/scripts/cachemanager.py scan [模式]
- 连接测试:python3 $WORKSPACE/skills/memory-cache/scripts/cachemanager.py ping
键命名规范
严格遵循mema:前缀:
- - mema:context: – 会话状态。
- mema:cache: – 临时数据。
- mema:state:* – 持久状态。