Skip to content

Latest commit

 

History

History
76 lines (54 loc) · 1.23 KB

README.md

File metadata and controls

76 lines (54 loc) · 1.23 KB

YoRedis

A minimalistic Redis client using modern Node.js.

Motivation

The goal is to write a minimal Redis client that:

  • Targets modern versions of Node.js: LTS and stable.
  • Uses Promises from the beginning, not just as an afterthought.
  • Allows async configuration which can accommodate modern credential stores such as Vault.

Usage

Basic usage:

const YoRedis = require('yoredis');

const redis = new YoRedis({ url: 'redis://127.0.0.1:6379' });

redis.call('ping')
  .then(function(reply) {
    console.log(reply);
  });

With dynamic, async configuration using Vaulted:

const redis = new YoRedis(function() {
  return vault.read({ id: 'redis/production' })
    .then(function(secret) {
      return {
        url: secret.url
      };
    });
});

redis.call('ping')
  .then(function(reply) {
    console.log(reply);
  });

Pipelining

redis.callMany([ [ 'ping' ], [ 'set', 'foo', 'bar' ], [ 'get', 'foo' ] ])
  .then(function(replies) {
    // replies is:
    // [
    //   'PONG',
    //   'OK',
    //   'bar'
    // ]
  })

Roadmap

  • Support streams.