New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

redis-hashring

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-hashring

This project allows you to create an Redis cluster. It uses the key passed on parameters to generate a hash to decide in which instance it should read or write the data

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
4
Maintainers
2
Weekly downloads
 
Created
Source

redis-hashring

This project allows you to create an Redis cluster used for caching purposes. It uses the key passed on parameters to generate a hash to decide in which instance it should read or write the data.

This project works best for very large applications with tons of small cache keys. It is basicaly a tool to shard values into many redis machines dividing load. It is not intended for applications that require huge reads of a small ammount of keys since that would put strain into a single machine.

It does have support for disaster recovery, if a machine is considered down redis-hashring will remove it from the ring and send the keys to other machines until that machine is back on again granting some safety for high availability.

Usage

Quick example using two Redis instances:

var RedisHashring = require("../lib/redis_hashring");

var redisHashring = new RedisHashring();

redisHashring.initialize(["localhost", "localhost:7777"]);

redisHashring.ready(function() {
    var key = "somekey",
        key2 = "otherkey";

    redisHashring.set(key, "Value", function(err, val) {
        redisHashring.get(key, function(err, val) {
            console.log(err, val);
        })
    });

    redisHashring.set(key2, "Value2", function(err, val) {
        redisHashring.get(key2, function(err, val) {
            console.log(err, val);
        })
    });

});

FAQs

Package last updated on 13 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts