node-ts-cache-storage-memory is a dedicated in-memory storage module for the node-ts-cache library, designed to provide fast, local caching capabilities within Node.js applications. It is currently stable, with version 4.4.0 being the latest as of April 2026, and follows an active release cadence addressing bug fixes and performance enhancements. A key differentiator is its seamless integration with the node-ts-cache decorator-based caching system and the introduction of an 'enqueue' feature in v4.3.4 to prevent thundering herd problems by ensuring the original method is called only once even under high concurrency. This package focuses solely on in-memory storage, contrasting with other node-ts-cache storage modules like Redis or file-based options, and is primarily intended for scenarios where persistent or distributed caching is not required.
npm install node-ts-cache-storage-memoryVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to set up and use `MemoryStorage` with `node-ts-cache` decorators, including basic caching and TTL expiration.
Adjust `ttl` values in your `@Cache` decorators or `CacheContainer` configurations to represent seconds instead of milliseconds.
No fix required, this is a behavioral improvement. Review your application logic if it depends on specific timing or multiple simultaneous executions of a cached method.
Ensure both `node-ts-cache` and `node-ts-cache-storage-memory` are installed: `npm i node-ts-cache node-ts-cache-storage-memory`.
Ensure `node-ts-cache` is installed alongside `node-ts-cache-storage-memory` (`npm i node-ts-cache node-ts-cache-storage-memory`) and that `CacheContainer` is correctly instantiated with a `MemoryStorage` instance.
For CommonJS, use `const { MemoryStorage } = require('node-ts-cache-storage-memory');`. For ESM, ensure `import { MemoryStorage } from 'node-ts-cache-storage-memory';` is present and the package is installed.Ensure the `ttl` option is a valid number representing *seconds*. If upgrading to `v4.3.4` or later, remember `ttl` in non-lazy mode now correctly means seconds, not milliseconds.