Registry / storage / cacheman-memory

cacheman-memory

JSON →
library1.1.0jsnpmunverified

An in-memory caching library for Node.js, version 1.1.0, serving as a cache engine for the cacheman module. It provides a simple key-value store with TTL support and callback-based API. Unlike persistent stores like Redis or Memcached, this is lightweight and zero-config, suitable for single-process caching. Last updated in 2013, it is no longer actively maintained but still functional for legacy projects. The package is stable but deprecated in favor of modern alternatives like lru-cache or native Map.

npm install cacheman-memory
INSTALL
IMPORT
SIG · CACHEMAN-MEMORY
C
cacheman-memory
storagejavascriptv1.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 'cacheman-memory';
const cachemanMemory = require('cacheman-memory');
ESM default import works; CommonJS require also works since the package is not strictly ESM.
CachemanMemory
const CachemanMemory = require('cacheman-memory');
import { CachemanMemory } from 'cacheman-memory';
CommonJS require is the most common pattern; named import fails because the module exports a single constructor as default.
new CachemanMemory()
let cache = new CachemanMemory();
let cache = CachemanMemory();
Must use new operator; calling without 'new' assigns to global object.

Demonstrates creating a memory cache, setting an item with TTL, retrieving it, and deleting it using callbacks.

import CachemanMemory from 'cacheman-memory'; const cache = new CachemanMemory(); cache.set('myKey', { foo: 'bar' }, 60, (err) => { if (err) { console.error(err); return; } cache.get('myKey', (err, value) => { if (err) throw err; console.log(value); // { foo: 'bar' } cache.del('myKey', (err) => { if (err) throw err; console.log('deleted'); }); }); });
Debug
Known issues
deprecatedPackage is no longer maintained; last update 2013.
fix
Consider using lru-cache or native Map for in-memory caching.
affects: >=0.0.0
gotchaCallback-based API; no promise support. All operations use Node-style callbacks.
fix
Wrap with util.promisify or use modern alternatives.
affects: >=0.0.0
breakingPossible global scope pollution if CachemanMemory is called without 'new'.
fix
Always use the 'new' keyword to instantiate.
affects: >=0.0.0
gotchaTTL is in seconds, not milliseconds.
fix
Convert milliseconds to seconds before passing ttl.
affects: >=0.0.0
gotchaget() returns null for missing keys, not undefined.
fix
Check for null explicitly.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: cache.set is not a function
CachemanMemory instance not created with 'new', so cache is undefined.
fix
const cache = new CachemanMemory();
TypeError: cache.get(...) is not a function
CachemanMemory instance not created with 'new', so cache is undefined.
fix
const cache = new CachemanMemory();
Cannot find module 'cacheman-memory'
Package not installed or typo in require/import.
fix
npm install cacheman-memory
Error: callback is not a function
Missing callback argument in set/get/del/clear.
fix
Always pass a callback function to async methods.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
18
OpenAI (training)
1
Resources
cacheman-memory — npm install cacheman-memory · libregistry