A lightweight file caching library that uses file modification times (mtime) to determine cache staleness. Current stable version is 0.4.0, released occasionally with minimal maintenance. It provides both persistent file-based caching and optional in-memory caching. Differentiators: dirt-simple API with just init, add, get, and clear methods; uses OS temp directory for persistence; TypeScript typings included. Ideal for simple build tool caches or any scenario where fast, zero-config file caching is needed.
npm install dirt-simple-file-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes a cache instance, adds an entry, retrieves it, and verifies missed cache returns null.
Do not use keepInMemoryCache if source files may change during runtime. For correctness, always use file-based cache.
If you need a custom cache directory, pass a specific root path to init (e.g., projectRoot). The library uses that root directory for caching.
Always await cache.clear() in async contexts.
N/A
Use const { DirtSimpleFileCache } = require('dirt-simple-file-cache') or import { DirtSimpleFileCache } from 'dirt-simple-file-cache'Ensure cache = await DirtSimpleFileCache.init(...) before using get/add/clear.
Ensure the directory passed to init exists and is writable. The library does not create intermediate directories automatically.