content-hash-cache-pattern

Cache file-processing results using SHA-256 content hashes as keys.

86|21|Updated Feb 9, 2026
One-click install
npx skills add https://github.com/Jamkris/everything-gemini-code --skill content-hash-cache-pattern-jamkris
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: content-hash-cache-pattern
Source: https://github.com/Jamkris/everything-gemini-code/tree/main/skills/content-hash-cache-pattern
Command: npx skills add https://github.com/Jamkris/everything-gemini-code --skill content-hash-cache-pattern-jamkris

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cache expensive file processing results using SHA-256 content hashes as cache keys. This approach is path-independent and auto-invalidates when content changes, reducing redundant computation.

Core Features & Use Cases

  • Content-hash based cache keys for stable caching across moves/renames.
  • File-based cache storage with deterministic JSON entries.
  • Service-layer wrapper that separates processing logic from caching to preserve purity.
  • Suitable for file-processing pipelines like PDF parsing, OCR, text extraction, and image analysis.

Quick Start

Enable the content-hash cache in your file-processing workflow and run a batch of files to populate the cache.

Frequently Asked Questions about content-hash-cache-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I cache expensive file processing results to avoid recomputation across pipeline runs?

Cache expensive file processing results by hashing file content with SHA-256 to produce stable, path-independent cache keys. This approach stores deterministic JSON entries in a file-based cache, automatically invalidating when content changes and preventing redundant computation across runs.

Why does my file-processing cache break when files are moved or renamed?

File-processing caches keyed by file path break on moves or renames because the path changes. Using SHA-256 content-hash keys solves this by making the cache path-independent, so the cached results remain valid regardless of where the file is located.

How do I set up a content-hash cache for PDF parsing and OCR pipelines?

Set up a content-hash cache for PDF parsing and OCR by separating your pure processing function from the caching logic, then wrapping it with a service layer that orchestrates read/write operations and handles cache misses using file-based storage keyed by SHA-256 hashes.

Does the content-hash cache pattern require a specific storage backend or framework?

The content-hash cache pattern does not require a specific framework, as it has no dependencies. It requires a file-based cache storage system with deterministic JSON entries and a small service layer to orchestrate read/write operations and handle cache misses.

What's the best way to auto-invalidate cached text extraction results when source files change?

The best way to auto-invalidate cached text extraction results is to use SHA-256 content hashing for cache keys. Because the hash is derived from the file content itself, any modification to the source file produces a new hash, naturally invalidating the old cache entry.

When should I not use a content-hash cache pattern for file processing?

You should not use a content-hash cache pattern when your processing function cannot be separated into a pure function, or when the overhead of computing SHA-256 hashes for very large files outweighs the computational cost of the file processing itself.