Registry / database / cachetree-redis

cachetree-redis

JSON →
library3.0.0jsnpmunverified

Redis storage backend for Cachetree, a caching library. Version 3.0.0 provides an adapter that connects Redis to Cachetree's tree-based caching system. It wraps the redis npm client and handles serialization, database selection, and authentication. This package is specifically for Cachetree users who want a Redis store; it is not a general-purpose Redis client. Release cadence is low; maintained as part of the Cachetree ecosystem.

npm install cachetree-redis
INSTALL
IMPORT
SIG · CACHETREE-REDIS
C
cachetree-redis
databasejavascriptv3.0.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.

default
var cachetreeRedis = require('cachetree-redis');
import cachetreeRedis from 'cachetree-redis';
CommonJS module only; ESM imports are not supported.
constructor
var store = cachetreeRedis({ host: 'localhost', port: 6379 });
var store = new cachetreeRedis();
Do not use 'new' keyword. The exported function returns a store instance.
client property
store.client
store.getClient()
The underlying Redis client is exposed as a property, not a method.

Create a Cachetree instance with a Redis backend, set and get a value.

var cachetreeRedis = require('cachetree-redis'); var cachetree = require('cachetree'); var store = cachetreeRedis({ host: 'localhost', port: 6379 }); var cache = cachetree(store); cache.set('foo', 'bar', function(err) { if (err) console.error(err); else cache.get('foo', function(err, value) { console.log(value); // 'bar' }); });
Debug
Known issues
gotchaRedis client options are passed to redis.createClient; if you provide a custom 'client' option, all other connection options are ignored.
fix
Eliminate port/host/options when using a pre-created client.
affects: >=0.0.0
gotchaThe 'pw' option for password can also be specified as 'pass' or 'password'; only one is used if both provided.
fix
Use a single password option to avoid confusion.
affects: >=0.0.0
gotchaautoCast defaults to true, meaning all values are JSON.stringify'd and JSON.parse'd. This can cause issues with binary data or non-serializable objects.
fix
Set autoCast: false in options if you need to store raw values.
affects: >=0.0.0
gotchaDatabase selection via 'db' or 'database' is ignored if a custom 'client' is provided.
fix
Select database on the client before passing it in.
affects: >=0.0.0
deprecatedThe redis npm package v3+ changes its API; this adapter may require updates for compatibility.
fix
Check redis version requirements; consider pinning redis to v2.x.
affects: >=3.0.0
Errors
Common errors & fixes
TypeError: cachetree is not a function
Forgot to require cachetree, or Cachetree version mismatch.
fix
Ensure 'var cachetree = require('cachetree');' and that cachetree exports a constructor.
Redis connection error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
Redis server not running or incorrect host/port.
fix
Start Redis server or provide correct host/port in options.
TypeError: store.client.get is not a function
Using store.client as if it were a direct Redis client; it is the store's client property but may be wrapped.
fix
Use store.client.get directly; it is the underlying Redis client.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
cachetreerequiredCore cache tree library required; this adapter is designed to be used with Cachetree instances.
redisrequiredUnderlying Redis client for database communication.
Agent activity
36 hits · last 30 days
node
32
OpenAI (training)
1
Resources
cachetree-redis — npm install cachetree-redis · libregistry