Registry / storage / cacher-redis

cacher-redis

JSON →
library0.0.1jsnpmunverified

A small adapter that uses Redis as a pluggable backend for the Cacher HTTP caching library (node-cacher). Version 0.0.1 is the initial release, with no active maintenance or updates since. It wraps node-redis to provide a Redis-based cache store, accepting the same connection options as node-redis.createClient or an existing Redis client instance. Keys are namespaced (default namespace: "cacher"). This package is specific to the now-dormant node-cacher ecosystem and is not recommended for new projects.

npm install cacher-redis
INSTALL
IMPORT
SIG · CACHER-REDIS
C
cacher-redis
storagejavascriptv0.0.1
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.

CacherRedis
const CacherRedis = require('cacher-redis')
import CacherRedis from 'cacher-redis'
Package is CommonJS only; ES import will fail unless using a bundler.
CacherRedis with existing client
const redisClient = require('redis').createClient(); const CacherRedis = require('cacher-redis'); const backend = new CacherRedis(redisClient)
Pass an existing Redis client to reuse connection.
new CacherRedis() with host/port
const backend = new CacherRedis('localhost', 6379, { namespace: 'myapp' })
const backend = new CacherRedis({ host: 'localhost', port: 6379 })
Constructor takes (host, port, opts) not an object, similar to node-redis.createClient.

Shows creating a CacherRedis backend with an existing Redis client and using it with Cacher.

const redis = require('redis'); const Cacher = require('cacher'); const CacherRedis = require('cacher-redis'); const redisClient = redis.createClient(); const cacheBackend = new CacherRedis(redisClient, { namespace: 'myapp' }); const cacher = new Cacher(cacheBackend); // Set a cache entry cacher.set('user:123', { name: 'Alice' }, 60 * 5); // Get the entry cacher.get('user:123', (err, value) => { if (!err && value) { console.log('Cached:', value); } });
Debug
Known issues
gotchaConstructor expects (host, port, opts) or (redisClient, opts), not an options object alone.
fix
Call new CacherRedis(host, port, opts) or new CacherRedis(redisClient, opts).
affects: >=0.0.0
gotchaNamespace is passed as opts.namespace but the default is "cacher" and may conflict between apps.
fix
Always provide a unique namespace in opts.
affects: >=0.0.0
deprecatedPackage has no updates or maintenance since 2011; likely incompatible with modern Redis versions.
fix
Use a maintained caching solution such as ioredis or keyv.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: CacherRedis is not a constructor
Using ES import or import syntax with CommonJS package.
fix
Use require('cacher-redis') instead of import.
Error: Redis connection failed
Redis server not running or incorrect host/port.
fix
Start Redis or verify connection parameters: new CacherRedis('localhost', 6379)
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies
node-cacherrequiredcore caching library this backend integrates with
redisrequiredRedis client dependency required for backend operation
Agent activity
28 hits · last 30 days
node
26
OpenAI (training)
1
Resources
cacher-redis — npm install cacher-redis · libregistry