content-hash-cache-pattern

Cache file processing results using SHA-256 content hashes.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/luongldptit/move-ticket --skill content-hash-cache-pattern-luongldptit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: content-hash-cache-pattern
Source: https://github.com/luongldptit/move-ticket/tree/main/.agent/skills/content-hash-cache-pattern
Command: npx skills add https://github.com/luongldptit/move-ticket --skill content-hash-cache-pattern-luongldptit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates wasted compute from re-running expensive file processing operations (such as PDF parsing, text extraction, or image analysis) when files are renamed, moved, or their content has not changed since the last processing run.

Core Features & Use Cases

  • Content-hash cache keys: Uses SHA-256 file content hashes instead of file paths, so cache hits work even after files are moved or renamed, and automatically invalidate when file content changes.
  • No external index required: Cache entries are stored as individual files named with their content hash for O(1) lookup, with no separate index file to manage or risk corruption.
  • Use Case: For teams running weekly batch PDF invoice extraction pipelines, this Skill caches extraction results so only files with updated content are re-processed, cutting total runtime from hours to minutes.

Quick Start

Use the content-hash-cache-pattern skill to add caching to your existing PDF text extraction function so it skips re-processing files that haven't changed since the last run.

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 stop batch processing pipelines from re-processing unchanged files?

Content-hash caching prevents re-processing unchanged files by using SHA-256 file hashes as cache keys instead of file paths. This ensures cache hits work even after files are moved or renamed, automatically invalidating only when content changes.

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

File-based caches typically break when files are renamed because they rely on file paths as cache keys. Using SHA-256 content hashes as cache keys instead ensures your cache survives file renaming, moving, and directory changes while invalidating correctly on content updates.

How do I add caching to pure processing functions without modifying their logic?

You can add caching to pure processing functions without modifying their logic by implementing a separate service layer. This architectural pattern wraps your existing PDF text extraction or image analysis functions with content-hash cache lookups, preserving the original processing core.

What is the best way to cache expensive file operations like PDF parsing?

The best way to cache expensive file operations like PDF parsing is using a file-based O(1) cache storage system keyed by SHA-256 content hashes. This eliminates the need for an external index file, preventing corruption risks while optimizing lookup speeds.

Do I need an external index file to manage cache invalidation for batch processing?

You do not need an external index file to manage cache invalidation. By storing cache entries as individual files named with their SHA-256 content hash, the system achieves O(1) lookup and automatic invalidation without the risk of index corruption.

Can I use content-hash caching for CLI tools with a cache toggle option?

Yes, you can use content-hash caching for CLI tools with a cache toggle option. This pattern applies to workflows where identical files are processed repeatedly across separate runs, ensuring only updated content triggers expensive text extraction or analysis operations.