Registry / database / cacheman

cacheman

JSON →
library2.2.1jsnpmunverified

A small and efficient cache provider for Node.js that supports in-memory, file, Redis, and MongoDB engines. Version 2.2.1 allows flexible configuration with TTL, custom delimiters, and Promise support. It provides a simple unified API (set, get, del, clear) with both callback and Promise interfaces. Unlike single-engine caches, cacheman lets you switch engines without changing application code, making it ideal for development vs production environments.

databasedevops
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.

ESM only since v2.0.0

import Cacheman from 'cacheman'

Must use new keyword

const cache = new Cacheman();

When passing engine options as second arg, first arg must be the name

const cache = new Cacheman('myapp', { ttl: 300, engine: 'redis' });

Creates a cache instance with a 60-second TTL, stores and retrieves a user object, then deletes and clears.

import Cacheman from 'cacheman'; const cache = new Cacheman('myapp', { ttl: 60 }); await cache.set('user', { name: 'Alice' }); const user = await cache.get('user'); console.log(user); // { name: 'Alice' } await cache.del('user'); await cache.clear(); console.log('done');
Debug
Known footguns
deprecatedCallback API is deprecated in favor of Promises
gotchaEngine must be installed separately; no runtime dependency
gotchaTLL value accepts human-readable strings (e.g., '1m') but only if you install the 'ms' package
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
8 hits · last 30 days
gptbot
3
mj12bot
1
ahrefsbot
1
Resources