Registry / database / redback

redback

JSON →
library0.5.1jsnpmunverified

Redback is a high-level Redis library for Node.js providing an accessible and extensible interface to Redis data types. Version 0.5.1 is the current stable release, with infrequent updates. It extends the popular node_redis client with built-in structures like List, Set, SortedSet, Hash, Channel, Cache, and advanced structures such as DensitySet, KeyPair, SocialGraph, CappedList, Queue, RateLimit, and BloomFilter. Its key differentiator is the ability to create custom structures easily via redback.addStructure(), enabling developers to define domain-specific data types. Unlike raw node_redis, Redback abstracts Redis commands into intuitive JavaScript objects and methods. It is dependency on node_redis as a peer dependency and supports both callback and event patterns.

npm install redback
INSTALL
IMPORT
SIG · REDBACK
R
redback
databasejavascriptv0.5.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.

default (createClient)
import redback from 'redback'; const client = redback.createClient();
var redback = require('redback').createClient();
Redback does not export a default; use named import or require. createClient() creates a new redis client internally.
use() for existing redis client
import { use } from 'redback'; const redback = use(redisClient);
const redback = require('redback').use(redisClient);
Prefer passing an existing node_redis client via use() to share connections.
createSocialGraph
const graph = redback.createSocialGraph(3);
const graph = redback.SocialGraph.create(3);
All structure creation is via createX methods on the redback instance.

Demonstrates basic cache usage: create a redback client, set and retrieve a cached value.

import { createClient, createCache } from 'redback'; const client = createClient(); const cache = createCache('mycache'); cache.set('greeting', 'Hello World', (err) => { if (err) throw err; cache.get('greeting', (err, value) => { console.log(value); // Hello World client.quit(); }); });
Debug
Known issues
gotchaRedis database #11 is flushed during tests; never use #11 in production.
fix
Use a different database index or avoid running tests on production Redis.
affects: >=0.0.0
deprecatedRedback is in maintenance mode; many features rely on an outdated node_redis version. No active development.
fix
Consider migrating to ioredis for active support and modern features.
affects: >=0.5.0
gotchaStructures like BloomFilter and RateLimit use Lua scripts that may not be compatible with Redis Cluster.
fix
Use standalone Redis or test cluster compatibility before deployment.
affects: >=0.0.0
gotchaRateLimit structure relies on accurate local clock; time skew between client and server can cause incorrect counts.
fix
Ensure NTP sync or implement robust time handling.
affects: >=0.2.0
breakingIn version 0.3.0, the 'createQueue' method was renamed to 'createSimpleQueue'. Old code using createQueue will break.
fix
Use createSimpleQueue instead or upgrade and rename calls.
affects: <0.3.0
Errors
Common errors & fixes
TypeError: redback.createClient is not a function
Importing Redback incorrectly, e.g., using ES6 default import when package uses CommonJS.
fix
Use const redback = require('redback'); or if using ES modules, use import * as redback from 'redback';
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
Redis server not running or not accessible on default host/port.
fix
Start Redis server with redis-server, or specify custom host/port via createClient({host: '...', port: ...}).
ReplyError: MOVED 1234 192.168.1.1:6379
Using Redback with Redis Cluster; Lua script-based structures are not cluster-compatible.
fix
Use a standalone Redis instance or avoid cluster-dependent structures like BloomFilter and RateLimit.
TypeError: redback.addStructure is not a function
Using an outdated version where addStructure was not yet introduced or attempting to call before require.
fix
Ensure redback version >=0.2.0 and import correctly: const redback = require('redback');
Upgrade
Version history
0.5.1latest on npm
Audit
Dependencies
redisrequiredRedback wraps node_redis client; must be installed separately as a peer dependency
Agent activity
8 hits · last 30 days
node
6
Meta
1
Resources
redback — npm install redback · libregistry