Cache manager for Node.js (v7.2.8) providing a consistent interface for in-memory and distributed caching. Built on Keyv storage adapters supporting Redis, MongoDB, SQLite, and more. Key differentiators: simple wrapper for functions, tiered caches, background refresh of expiring keys, and non-blocking multi-store optimization. Actively maintained with 100% test coverage. Breaking change in v7: get returns undefined instead of null. Major v6 rewrite replaced custom stores with Keyv adapters.
npm install cache-managerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic set, get, and delete operations with TTL using memory store
Replace null checks with undefined checks (e.g., if (result !== undefined))
Use createCache() with Keyv stores instead of memoryStore() etc.
Replace caching() with createCache()
Set { serialization: undefined, deserialization: undefined } in Keyv options for binary dataUse import syntax or dynamic import()
Use import { createCache } from 'cache-manager'Ensure tsconfig.json includes 'esModuleInterop': true and 'moduleResolution': 'node'
Pass Keyv instances via stores array, not old store functions