node-redis-client

0.0.10 • Public • Published

node-redis-client NPM version Build Status Dependency Status

node-redis-client is a fast and lightweight Redis client for Node.js

If you're interested in performance benchmarks, a comparison with node-redis can be found in the bench directory. Included is a slightly modified node-redis multi-bench utility. All benchmarks were taken on an Ubuntu Server VM running on a late 2011 MBP.

Usage

// Import
var RedisClient = require('node-redis-client');

// Create client
var client = new RedisClient(options);

// Client connected to Redis
client.on('connect', function () {

  // Simple ping/pong with callback
  client.call('PING', function (error, result) {
    assert.equal(result, 'PONG');
  });

  // Multiple parameters with callback
  clienti.call('SET', 'foo', 'bar', function (error, result) {
    assert.equal(result, 'OK');
  });

  // Multi block with callback only on EXEC
  client.call('MULTI');
  client.call('SET', 'foo', 'bar');
  client.call('GET', 'foo');
  client.call('EXEC', function (error, results) {
    assert.equal(results[0], 'OK');
    assert.equal(results[1], 'BAR');

    // Quit client
    client.quit();
  });
});

// Client closed
client.on('close', function (error) { ... });

// Non-fatal error response when callback omitted
client.on('call-error', function (error) { ... });

// Fatal client error
client.on('error', function (error) { ... });

RedisClient options

port

  • Type: number
  • Default: 6379

host

  • Type: string
  • Default: 127.0.0.1

path

  • Type: string // unix domain socket

db

  • Type: number
  • Default: 0

maxCallbackDepth

  • Type: number
  • Default: 256

Testing

Linting, coverage and complexity checks are handled by gulp-test. Enter gulp from your command line for options.

License

Copyright (c) 2014 Justin Freitag. See the LICENSE file for license rights and limitations (MIT).

Readme

Keywords

Package Sidebar

Install

npm i node-redis-client

Weekly Downloads

10

Version

0.0.10

License

MIT

Last publish

Collaborators

  • justinfreitag