What problem does it solve?
Path-based file processing caches break when files are moved or renamed, require manual invalidation when file content changes, and often force modifications to existing pure processing functions to add caching logic.
Core Features & Use Cases
- Content-hash cache keys: Uses SHA-256 file content hashes instead of file paths, so caches work even after files are moved or renamed, and automatically invalidate when content changes.
- Pure function preservation: Keeps processing functions free of caching logic via a separate service layer wrapper, adhering to single responsibility principles.
- O(1) file-based cache storage: Stores cache entries as individual JSON files named by their content hash, eliminating the need for a separate index file and enabling fast lookups.
- Use Case: Use this pattern for batch PDF parsing, OCR, or image analysis pipelines where the same files are processed repeatedly across runs, cutting down redundant processing time.
Quick Start
Use the content-hash-cache-pattern skill to add automatic, path-independent caching to your existing PDF text extraction pipeline so repeated runs skip already processed files without modifying your original extraction code.