Individual skill

content-hash-cache-pattern

使用 SHA-256 内容哈希缓存高昂的文件处理结果 —— 与路径无关、自动失效且服务层分离。

skills/content-hash-cache-pattern/SKILL.md

Read pinned source

Source commit dfbf9467b90dfd29bffa842c4e0a6977112900e2

What was checked

Matches the observed repository HEAD
Yes
Scanner rules are current
No
Repository scan complete
No
Skill scan complete
No
Observed behavior
Not checked yet
Last checked
Nov 3, 2026

These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.

Install this skill

Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.

An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.

Repository context

Repository stars (not skill ratings)
2,024
Repository last updated
Mar 5, 2026
License
MIT

Observed agent integration: No specific integration evidence. Standard SKILL.md installation does not imply verified compatibility.

Files and excerpt

File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.

Browse files
Read excerpt

# 内容哈希文件缓存模式 (Content-Hash File Cache Pattern)

使用 SHA-256 内容哈希(而非文件路径)作为缓存键,缓存高昂的文件处理结果(如 PDF 解析、文本提取、图像分析)。与基于路径的缓存不同,这种方法在文件移动/重命名后依然有效,并在内容变化时自动失效。

## 何时激活

- 构建文件处理流水线(Pipeline),如 PDF、图像或文本提取
- 处理成本高昂且需要重复处理相同文件
- 需要提供 `--cache/--no-cache` 命令行选项
- 希望在不修改现有纯函数(Pure Functions)的情况下为其添加缓存功能

## 核心模式

### 1. 基于内容哈希的缓存键