Registry / storage / cache-manager-redis

cache-manager-redis

JSON →
library0.6.0jsnpmunverified

Redis store for node-cache-manager (v0.6.0, last released 2018). Provides a caching layer using Redis as the backend, supporting single and multi-tier caching with configurable TTL, pattern-based key scanning via SCAN, and event listeners. It wraps the ioredis client and integrates with the cache-manager API for easy setup. The package has not been updated in years and is functionally replaced by cache-manager-ioredis or cache-manager-redis-store.

npm install cache-manager-redis
INSTALL
IMPORT
SIG · CACHE-MANAGER-REDI
C
cache-manager-redis
storagejavascriptv0.6.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.

redisStore
import redisStore from 'cache-manager-redis'
const { redisStore } = require('cache-manager-redis')
Default export is the store factory function. Do not destructure.
caching
const cacheManager = require('cache-manager'); cacheManager.caching({store: redisStore})
const caching = require('cache-manager-redis').caching
cache-manager-redis only exports the store; use cache-manager to create the cache.
events
redisCache.store.events.on('redisError', handler)
redisCache.store.on('error', handler)
Listen to 'redisError' on store.events, not directly on store.

Creates a Redis-backed cache and demonstrates set/get/del operations with error handling.

const cacheManager = require('cache-manager'); const redisStore = require('cache-manager-redis'); const redisCache = cacheManager.caching({ store: redisStore, host: 'localhost', port: 6379, auth_pass: process.env.REDIS_PASSWORD ?? '', db: 0, ttl: 600 }); redisCache.set('foo', 'bar', { ttl: 5 }, (err) => { if (err) throw err; redisCache.get('foo', (err, result) => { console.log(result); // 'bar' redisCache.del('foo', () => {}); }); });
Debug
Known issues
deprecatedPackage is legacy; use cache-manager-ioredis or cache-manager-redis-store instead.
fix
Replace dependency with cache-manager-redis-store or cache-manager-ioredis.
affects: >=0.5.0
gotchaTLS is not directly supported; you must pass a custom redis instance.
fix
Use the redisInstance option with an ioredis instance configured for TLS.
affects: >=0.1.0
gotchaThe internal Redis client is ioredis; do not confuse with node_redis.
fix
Use commands and options as per ioredis documentation, not node_redis.
affects: >=0.1.0
gotchaauth_pass option is used; for ioredis compatibility, use the redisInstance option for complex auth.
fix
If using redisInstance, set password in that instance.
affects: >=0.1.0
breakingNode.js 4+ required in v0.6.0.
fix
Update Node.js or use an older version of the package.
affects: >=0.6.0
Errors
Common errors & fixes
Error: Callback is not a function
Calling set/get without a callback function (required in older versions).
fix
Always provide a callback: cache.set('key', 'value', (err) => { ... }).
node_redis was not found, please install redis
Misunderstanding of the underlying client: this package uses ioredis, not node_redis.
fix
Ensure ioredis is installed; do not install node_redis unless needed.
Cannot find module 'cache-manager-redis'
Package is not installed or import path is wrong.
fix
Run npm install cache-manager-redis and use require('cache-manager-redis').
Upgrade
Version history
0.6.0latest on npm
Audit
Dependencies
cache-managerrequiredpeer dependency - provides the caching API
ioredisrequiredRedis client used internally
Agent activity
30 hits · last 30 days
node
30
Resources
cache-manager-redis — npm install cache-manager-redis · libregistry