A lightweight, file-based caching library with Time-To-Live (TTL) support, built on top of flat-cache. Current version 1.0.1 provides convenient methods set(), get(), and del() that automatically handle expiration, while still exposing the underlying flat-cache API. It defaults to no expiry unless explicitly configured. Key differentiator is the simplicity of adding TTL to flat-cache without additional dependencies. The package ships TypeScript types.
npm install ttl-flat-cache-fixedNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates initialization with options object, set/get with TTL, and checking remaining time using ttl() method.
Use cache.set(key, value, ttl) instead of cache.setKey(key, value).
Install and import from 'ttl-flat-cache-fixed', not 'flat-cache'.
Check that you pass ttl to set() if you want a specific expiration; otherwise rely on the default.
Use cache.destroy() to clean up cache files instead of manual deletion.
Run 'npm install ttl-flat-cache-fixed' and ensure your project uses ESM (type: module in package.json) or use dynamic import: const cache = await import('ttl-flat-cache-fixed');Use default import: import cache from 'ttl-flat-cache-fixed'; then invoke cache(opts).
Access flat-cache methods through the cache instance returned from cache(opts), e.g., const myCache = cache(opts); myCache.getKey(key);