← 返回 Skills 市场
xueyetianya

Cache

作者 bytesagain4 · GitHub ↗ · v2.0.0 · MIT-0
cross-platform ✓ 安全检测通过
236
总下载
0
收藏
2
当前安装
1
版本数
在 OpenClaw 中安装
/install cache
功能描述
Manage a local key-value cache store using bash and Python. Use when caching API responses, session data, or computed results with TTL support.
使用说明 (SKILL.md)

Cache — Local Key-Value Cache Manager

A lightweight, file-backed key-value cache with TTL (time-to-live) support, search, bulk import/export, and statistics. Ideal for caching API responses, computed results, or any ephemeral data that benefits from quick local retrieval.

Prerequisites

  • Python 3.6+
  • Bash 4+

Data Storage

Cache entries are stored in ~/.cache-tool/data.jsonl (note: uses cache-tool to avoid conflicts with ~/.cache). Each line is a JSON object with fields: key, value, ttl, created_at, expires_at, tags, etc.

Configuration lives in ~/.cache-tool/config.json.

Commands

Run via: bash scripts/script.sh \x3Ccommand> [options]

Command Description
set Store a key-value pair with optional TTL and tags
get Retrieve the value for a given key
delete Remove a key from the cache
list List all cache entries (with optional tag filter)
flush Delete all cache entries or those matching a pattern
ttl Check or update the TTL for an existing key
stats Show cache statistics (size, hit/miss ratio, memory)
export Export the cache to a JSON file
import Import cache entries from a JSON file
search Search keys or values by substring or regex
config View or update cache settings (default TTL, max size)
help Show usage information
version Print the tool version

Usage Examples

# Set a simple key-value pair
bash scripts/script.sh set --key api_response --value '{"status":"ok"}' --ttl 3600

# Set with tags
bash scripts/script.sh set --key user:42 --value '{"name":"Kelly"}' --tags user,profile

# Get a value
bash scripts/script.sh get --key api_response

# Delete a key
bash scripts/script.sh delete --key old_data

# List all entries
bash scripts/script.sh list

# List entries by tag
bash scripts/script.sh list --tag user

# Check remaining TTL
bash scripts/script.sh ttl --key api_response

# Update TTL
bash scripts/script.sh ttl --key api_response --set 7200

# Flush all entries
bash scripts/script.sh flush

# Flush by pattern
bash scripts/script.sh flush --pattern "user:*"

# Search by key pattern
bash scripts/script.sh search --query "api_" --field key

# Show cache stats
bash scripts/script.sh stats

# Export cache
bash scripts/script.sh export --output cache_backup.json

# Import cache
bash scripts/script.sh import --input cache_backup.json

# Configure defaults
bash scripts/script.sh config --set default_ttl=3600 --set max_entries=10000

Notes

  • Expired entries are lazily cleaned: they are skipped on get and purged during flush or stats.
  • The search command supports both simple substring matching and Python regex patterns.
  • import merges entries; existing keys are overwritten.
  • stats reports total entries, expired count, active count, and approximate data size.

Output Format

get returns the raw value to stdout. All other commands return JSON objects with status and metadata.


Powered by BytesAgain | bytesagain.com | [email protected]

安全使用建议
This skill appears to do exactly what it says: a lightweight, local file-backed cache. Before installing, be aware that (1) it creates and maintains data/config files in ~/.cache-tool which will persist on disk; (2) 'get' prints raw stored values (so do not store secrets you don't want exposed); (3) the tool does not request or use external credentials or network access; and (4) the script uses simple file writes without locking, so concurrent access could result in races. If you need to store sensitive data, consider encrypting values or using a different secure store. If you want absolute assurance, review the full script (scripts/script.sh) for the remaining truncated sections before use.
功能分析
Type: OpenClaw Skill Name: cache Version: 2.0.0 The skill bundle provides a legitimate local key-value cache management tool using Bash and Python. It implements standard cache operations (set, get, delete, list, search, etc.) with TTL support, storing data in a dedicated directory (~/.cache-tool/). The code logic in scripts/script.sh is transparent, uses environment variables for argument passing to Python, and lacks any indicators of data exfiltration, unauthorized execution, or persistence mechanisms.
能力评估
Purpose & Capability
The name/description (local key-value cache with TTL) matches the provided script and SKILL.md: commands (set/get/list/flush/ttl/stats/import/export/search/config) and storage in ~/.cache-tool are coherent with the stated purpose.
Instruction Scope
Runtime instructions direct the agent to run bash scripts/script.sh and the script persistently writes/reads files under ~/.cache-tool (data.jsonl and config.json). This is expected for a cache tool, but users should note that data is stored on disk and 'get' prints raw values to stdout. The script exports ARGS into the environment for embedded Python parsers, which may affect how argument quoting/spaces are handled.
Install Mechanism
No install spec or external downloads; the skill is instruction-only with a bundled script. Nothing is fetched from remote URLs or installed system-wide.
Credentials
The skill declares no required environment variables or credentials and the script only uses internally-defined DATA_FILE/CONFIG_FILE derived from $HOME. No unrelated secrets or external service credentials are requested.
Persistence & Privilege
The skill is user-invocable and not 'always:true'. It creates and writes files under the user's home directory (~/.cache-tool). This is normal for a local cache but does mean persistent data will remain on disk until removed.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install cache
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /cache 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.0.0
Domain-specific upgrade
元数据
Slug cache
版本 2.0.0
许可证 MIT-0
累计安装 2
当前安装数 2
历史版本数 1
常见问题

Cache 是什么?

Manage a local key-value cache store using bash and Python. Use when caching API responses, session data, or computed results with TTL support. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 236 次。

如何安装 Cache?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install cache」即可一键安装,无需额外配置。

Cache 是免费的吗?

是的,Cache 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Cache 支持哪些平台?

Cache 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Cache?

由 bytesagain4(@xueyetianya)开发并维护,当前版本 v2.0.0。

💬 留言讨论