redis-quick-callback
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "redis-quick-callback", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A redis client that callback immediately when no connection is present.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
redis-quick-callback | ||
==================== | ||
[![NPM](https://nodei.co/npm/redis-quick-callback.png)](https://nodei.co/npm/redis-quick-callback/) | ||
An enhancement to [mranney/node-redis](https://github.com/mranney/node_redis) that calls back immediately when no connection is present. When a connection is lost, `node-redis` client takes anywhere between 200ms to 2500ms to callback. One way around this to turn off `enable_offline_queue` and loose the awesome offline queuing functionality. This client calls back immediately and executes the command asynchronously. | ||
@@ -13,3 +15,3 @@ | ||
client.on('ready', function () { | ||
// when no connection exists | ||
// when no connection exists, err is returned immediately, the "set" is queued | ||
client.set('key', 'value', function (err) { | ||
@@ -19,3 +21,3 @@ console.log(err); // Err: No connection to server | ||
// redis connection is back | ||
// when redis connection is back, the queued "set" is executed and the value is available | ||
client.get('key', function (err, data) { | ||
@@ -41,2 +43,2 @@ console.log(data); // 'value' | ||
$ npm test | ||
``` | ||
``` |
4433
42