返回技能库

内存缓存

使用 Redis 的高性能临时存储系统。支持命名空间键(mema:*)、TTL 管理,以及会话上下文和 API 的 JSON 序列化...

作者:1999AZZAR · 最新版本:1.1.9

收藏:0 · 下载:1.5k

说明文档

# 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`.
2. Configure your connection in `.env`.
3. Dependencies are listed in `requirements.txt`.

## Core Workflows

### 1. Store and Retrieve
- **Store**: `python3 $WORKSPACE/skills/memory-cache/scripts/cache_manager.py set mema:cache:<name> <value> [--ttl 3600]`
- **Fetch**: `python3 $WORKSPACE/skills/memory-cache/scripts/cache_manager.py get mema:cache:<name>`

### 2. Search & Maintenance
- **Scan**: `python3 $WORKSPACE/skills/memory-cache/scripts/cache_manager.py scan [pattern]`
- **Ping**: `python3 $WORKSPACE/skills/memory-cache/scripts/cache_manager.py ping`

## Key Naming Convention
Strictly enforce the `mema:` prefix:
- `mema:context:*` – Session state.
- `mema:cache:*` – Volatile data.
- `mema:state:*` – Persistent state.