A resilient caching library for Node.js (version 6.0.2, latest) that supports concurrent requests through local in-memory cache or Redis. Designed for internal use at Unito, it is undocumented but ships with TypeScript source code. Key differentiators include built-in concurrency handling to avoid thundering herd problems, a simple WriteThroughCache interface, and support for custom TTLs. Requires Node >=20 and npm >=10. Not recommended for production use outside of Unito due to lack of documentation and potential instability.
npm install cachetteNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
This shows how to initialize a WriteThroughCache with a Redis URL, define a fetch function, and use getOrFetchValue to cache results with TTL, demonstrating concurrency handling.
Do not use in production applications unless you are willing to maintain your own fork.
Upgrade to Node.js 20 or later.
Always provide a valid Redis URL or catch instantiation errors.
Monitor the changelog for API changes.
const cache = new WriteThroughCache(url);
Ensure Redis is running on localhost:6379 or provide a different REDIS_URL.
Use version >=6.0.0 and import { WriteThroughCache } from 'cachette'.