Cacheables is a small, typed in-memory cache library (v3.0.1) written in TypeScript with zero dependencies. It wraps async functions with `remember()`, supporting five cache policies including stale-while-revalidate and concurrency-safe deduplication. A key differentiator is multilayer storage: stack a fast L1 memory bucket with any L2 (filesystem, Redis, S3) and cascading reads backfill missing layers. Fully typed with a generic TView projection. Released monthly on GitHub. Supports browser and Node.js >=18. ESM-only since v3.
npm install cacheablesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: create a Cacheable instance with a MemoryBucket and max-age policy, then use remember() to cache an async fetch call.
Switch to ESM imports. For Node <18 use v2.x.
Use new Cacheable('namespace', { buckets: [new MemoryBucket()] }).Implement your own eviction or use a different bucket that supports limits.
Omit the policy option to use default 'cache-only'.
Always provide at least one bucket in the 'buckets' array.
Pass at least one bucket, e.g., `new Cacheable('ns', { buckets: [new MemoryBucket()] })`.Use ESM imports or downgrade to v2.x.
Use named import: `import { Cacheable } from 'cacheables'`.Use constructor with options object: `new Cacheable('ns', { policy: 'cache-only', buckets: [...] })`.No dependency data recorded yet.