npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

redis-party

v0.6.0

Published

Redis client wrapper for clusters

Readme

redis-party

A redis client wrapper to support cluster connections.

This library can be used as a drop-in replacement for the regular node_redis client.

Install

npm install redis-party

Example

var nodes = [
    {"host": "node1.domain.com", "port": 10000},
    {"host": "node1.domain.com", "port": 10001},
    {"host": "node2.domain.com", "port": 10000},
    {"host": "node2.domain.com", "port": 10001},
];
var redis = require("redis-party");

var cluster = new redis.Cluster(nodes, {"max_attempts": 5});
cluster.once("ready", function () {
    cluster.SET("hello", "planet");

    var multi = cluster.multi();
    multi.SET("hello", "world");
    multi.GET("hello");
    multi.DEL("hello");
    multi.exec(function (err, res) {
        console.log("hello " + res[1]);
    });

    var multi2 = cluster.multi();
    multi2.SET("key1", "val");
    multi2.SET("key2", "val");
    multi2.exec(function (err, res) {
        //err = Error("Multi comands must operate on the same slot!")
    });

    cluster.PUBLISH("key1", "hello world!");
});

Alternative node_redis compatible interface:

var client = redis.createClient(port, host, options);
client.SET("foo", "bar", function () {
    client.GET("foo", function (err, bar) {
        console.log("foo = " + bar);
    });
});

Sending Commands

Just like node_redis, each redis command is exposed as a function on the client object.

All commands except multi are passed along to the correct node_redis client depending on the key hash.

API

Client Events

ready

The client will emit the ready event once the client is connected to the cluster and has populated the slot-node mapping table.

error

This client will emit the error event if there is an error with the cluster library.

redis_error

Error events emitted from the node_redis library.

message (channel, message)

Client will emit message for every message received that matches an active subscription.

clusterConfig

This event is emitted when a cluster config change has been detected. The cluster slot-node mapping table will be re-initialized, and the ready event will be emitted again once that is done.

cluster.createClient(port, host, options, [callback])

Create a new cluster instance. It will connect to the specified redis node and discover the rest of the nodes from there.

  • port - defaults to 6379
  • host - defaults to 127.0.0.1
  • options - same as node_redis client options

cluster.Cluster(nodes, redisOptions, callback)

Create a new cluster instance. It will connect to the first available redis node and discover the rest of the nodes from there.

  • nodes - an array of objects with host and port properties.
  • redisOptions - node_redis client options. See node_redis documentation.

client.quit()

Cleanly end connections to all cluster nodes by sending the QUIT command after handling all replies.

client.getSlot(key)

Returns the slot which will be used for a key.

client.getConnectionBySlot(slot, callback)

Get the node_redis instance for a specific slot.