Registry / storage / node-cache-manager

node-cache-manager

JSON →
library1.2.0jsnpmunverified

A simple in-memory cache manager for Node.js applications, version 1.2.0. It provides basic caching functionality with TTL support, suitable for small projects or simple caching needs. However, note that the package is outdated (last release from 2018) and has not been maintained, with no support for advanced features like clustering, persistence, or multi-tier caching that modern alternatives like keyv or node-cache offer. The package uses a singleton pattern and is not recommended for new projects.

npm install node-cache-manager
INSTALL
IMPORT
SIG · NODE-CACHE-MANAGER
N
node-cache-manager
storagejavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import cacheManager from 'node-cache-manager'
const cacheManager = require('node-cache-manager')
The package is CommonJS-only; using import may require a bundler. The example shows require.
CacheManager
const { CacheManager } = require('node-cache-manager')
TypeScript users may want the named export, but the package does not ship TypeScript definitions.
get
const cache = require('node-cache-manager'); cache.get('key')
The module exports a singleton instance with methods get, set, del, clear.

Demonstrates basic set, get, del, and clear operations with TTL.

const cache = require('node-cache-manager'); // Set a value with TTL in seconds cache.set('myKey', { data: 'hello' }, 60); // expires in 60 seconds // Get a value const value = cache.get('myKey'); if (value) { console.log(value.data); // 'hello' } else { console.log('Key not found or expired'); } // Delete a key cache.del('myKey'); // Clear all cache cache.clear(); console.log('Cache operations complete');
Debug
Known issues
deprecatedPackage is no longer maintained. No updates since 2018.
fix
Use a maintained alternative like keyv or node-cache.
affects: *
gotchaThe cache is a global singleton; multiple requires share the same store.
fix
Be aware that clearing the cache in one module affects all others.
affects: *
gotchaTTL is in seconds, not milliseconds.
fix
Convert your TTL: e.g., 5 minutes = 300 seconds.
affects: *
Errors
Common errors & fixes
TypeError: cache.set is not a function
Likely using ES import syntax with a CommonJS-only module.
fix
Use require('node-cache-manager') instead of import.
Module not found: Can't resolve 'node-cache-manager'
Package not installed or name mistyped.
fix
Run 'npm install node-cache-manager' and ensure package.json contains it.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
16
Amazon
1
Resources
node-cache-manager — npm install node-cache-manager · libregistry