Registry / database / recacheman-memory

recacheman-memory

JSON →
library2.1.0jsnpmunverified

In-memory caching library for Node.js, also usable as a cache engine for recacheman. Version 2.1.0 targets Node.js 20 and 22. Fork of cacheman-memory with active maintenance. Provides promise-based and callback-based API, TTL support, and TypeScript declarations. Differentiated by simplicity and zero external dependencies.

npm install recacheman-memory
INSTALL
IMPORT
SIG · RECACHEMAN-MEMORY
R
recacheman-memory
databasejavascriptv2.1.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.

CachemanMemory
import CachemanMemory from 'recacheman-memory'
const { CachemanMemory } = require('recacheman-memory')
ESM default import; CommonJS requires `const CachemanMemory = require('recacheman-memory')`

ESM usage with promises: set, get, and delete a cache entry.

import CachemanMemory from 'recacheman-memory'; const cache = new CachemanMemory(); // Set with TTL (60 seconds) cache.set('mykey', { foo: 'bar' }, 60).then(value => { console.log('Set:', value); return cache.get('mykey'); }).then(value => { console.log('Get:', value); return cache.del('mykey'); }).then(() => { console.log('Deleted'); }).catch(err => { console.error(err); });
Debug
Known issues
breakingVersion 2.x drops support for Node.js < 20. Requires Node 20 or 22.
fix
Upgrade to Node.js 20+ or use recacheman-memory@1.x for older Node versions.
affects: >=2.0.0
deprecatedThe callback-based API is deprecated in favor of promise-based usage.
fix
Use promise chaining or async/await instead of callbacks.
affects: >=2.0.0
gotchaThe `.get()` method returns `null` for missing keys, not `undefined`.
fix
Check for `null` explicitly when retrieving values.
affects: >=1.0.0
gotchaTTL is in seconds, not milliseconds. Setting TTL=1 expires after 1 second.
fix
Convert milliseconds to seconds before passing TTL.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: cache.set is not a function
Using named import instead of default import in TypeScript/ESM.
fix
Use `import CachemanMemory from 'recacheman-memory'` then `new CachemanMemory()`.
ERR_REQUIRE_ESM: require() of ES Module
Using `require()` for an ESM-only package (v2+ ships ESM).
fix
Use `import` or set `type: "module"` in package.json and use `createRequire` if needed.
cache.getAll is not a function
Method renamed or removed in v2? Actually still present; ensure correct package version.
fix
Check documentation; use `cache.getAll()` exists in v2.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Meta
1
Resources
recacheman-memory — npm install recacheman-memory · libregistry