Comparing version 1.0.6 to 1.0.7
16
API.md
@@ -7,5 +7,6 @@ #Index | ||
* [new Redis([port], [host], [options])](#new_Redis) | ||
* [~~redis.createClient~~](#Redis#createClient) | ||
* [~~Redis.createClient()~~](#Redis.createClient) | ||
* [redis.connect()](#Redis#connect) | ||
* [redis.disconnect()](#Redis#disconnect) | ||
* [~~redis.end()~~](#Redis#end) | ||
* [redis.duplicate()](#Redis#duplicate) | ||
@@ -24,5 +25,6 @@ * [redis.monitor([callback])](#Redis#monitor) | ||
* [new Redis([port], [host], [options])](#new_Redis) | ||
* [~~redis.createClient~~](#Redis#createClient) | ||
* [~~Redis.createClient()~~](#Redis.createClient) | ||
* [redis.connect()](#Redis#connect) | ||
* [redis.disconnect()](#Redis#disconnect) | ||
* [~~redis.end()~~](#Redis#end) | ||
* [redis.duplicate()](#Redis#duplicate) | ||
@@ -66,2 +68,3 @@ * [redis.monitor([callback])](#Redis#monitor) | ||
- \[connectTimeout=10000\] `number` - The milliseconds before a timeout occurs during the initial connection to the Redis server. | ||
- \[autoResubscribe=true\] `boolean` - After reconnected, if the previous connection was in the subscriber mode, client will auto re-subscribe these channels. | ||
- \[lazyConnect=false\] `boolean` - By default, | ||
@@ -97,4 +100,4 @@ When a new `Redis` instance is created, it will connect to Redis server automatically. | ||
<a name="Redis#createClient"></a> | ||
##~~redis.createClient~~ | ||
<a name="Redis.createClient"></a> | ||
##~~Redis.createClient()~~ | ||
Create a Redis instance | ||
@@ -116,2 +119,7 @@ | ||
<a name="Redis#end"></a> | ||
##~~redis.end()~~ | ||
Disconnect from Redis. | ||
***Deprecated*** | ||
<a name="Redis#duplicate"></a> | ||
@@ -118,0 +126,0 @@ ##redis.duplicate() |
## Changelog | ||
### v1.0.7 - April 25, 2015 | ||
* [ADD] Option `autoResubscribe` to prevent auto re-subscribe. | ||
* [ADD] Redis#end for compatibility. | ||
* [FIX] Redis.createClient(was Redis#createClient). | ||
### v1.0.6 - April 24, 2015 | ||
* [ADD] Support for connect timeout | ||
* [ADD] Support for connect timeout. |
@@ -99,4 +99,2 @@ var _ = require('lodash'); | ||
// TODO check scripts | ||
return promise.then(function () { | ||
@@ -103,0 +101,0 @@ var data = ''; |
@@ -12,3 +12,2 @@ var _ = require('lodash'); | ||
var Script = require('./script'); | ||
var SubscriptionQueue = require('./subscription_queue'); | ||
var utils = require('./utils'); | ||
@@ -51,2 +50,3 @@ var eventHandler = require('./redis/event_handler'); | ||
* @param {number} [options.connectTimeout=10000] - The milliseconds before a timeout occurs during the initial connection to the Redis server. | ||
* @param {boolean} [options.autoResubscribe=true] - After reconnected, if the previous connection was in the subscriber mode, client will auto re-subscribe these channels. | ||
* @param {boolean} [options.lazyConnect=false] - By default, | ||
@@ -141,3 +141,2 @@ * When a new `Redis` instance is created, it will connect to Redis server automatically. | ||
this.scriptsSet = {}; | ||
this.subscriptionQueue = new SubscriptionQueue(); | ||
@@ -167,5 +166,5 @@ if (this.options.sentinels) { | ||
*/ | ||
Redis.prototype.createClient = util.deprecate(function () { | ||
Redis.createClient = function () { | ||
return Redis.apply(this, arguments); | ||
}, 'Redis.createClient: Use new Redis() instead'); | ||
}; | ||
@@ -188,2 +187,3 @@ /** | ||
}, | ||
autoResubscribe: true, | ||
parser: 'auto', | ||
@@ -278,2 +278,11 @@ lazyConnect: false, | ||
/** | ||
* Disconnect from Redis. | ||
* | ||
* @deprecated | ||
*/ | ||
Redis.prototype.end = function () { | ||
this.disconnect.apply(this, arguments); | ||
}; | ||
/** | ||
* Create a new instance, using the same options. | ||
@@ -280,0 +289,0 @@ * |
@@ -156,3 +156,3 @@ var Queue = require('fastqueue'); | ||
} else { | ||
if (condition.mode.subscriber) { | ||
if (condition.mode.subscriber && self.options.autoResubscribe) { | ||
var subscribeChannels = condition.mode.subscriber.channels('subscribe'); | ||
@@ -159,0 +159,0 @@ if (subscribeChannels.length) { |
{ | ||
"name": "ioredis", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "A delightful, performance-focused Redis client for Node and io.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -136,4 +136,4 @@ # ioredis | ||
## Pipelining | ||
If you want to send a batch of commands(e.g. > 100), you can use pipelining to queue | ||
the commands in the memory, then send them to Redis all at once. This way the performance improves by 50%~300%. | ||
If you want to send a batch of commands(e.g. > 5), you can use pipelining to queue | ||
the commands in the memory, then send them to Redis all at once. This way the performance improves by 50%~300%(See [benchmark section](#benchmark)). | ||
@@ -140,0 +140,0 @@ `redis.pipeline()` creates a `Pipeline` instance. You can call any Redis |
@@ -47,2 +47,12 @@ describe('send command', function () { | ||
it('should handle empty buffer', function (done) { | ||
var redis = new Redis(); | ||
redis.set(new Buffer('foo'), new Buffer('')); | ||
redis.getBuffer(new Buffer('foo'), function (err, result) { | ||
expect(result).to.be.instanceof(Buffer); | ||
expect(result.toString()).to.eql(''); | ||
done(); | ||
}); | ||
}); | ||
it('should support utf8', function (done) { | ||
@@ -49,0 +59,0 @@ var redis = new Redis(); |
@@ -22,4 +22,12 @@ var Commander = require('../../lib/commander'); | ||
command = c.call('set', 'foo', 'bar', function () {}); | ||
expect(command.name).to.eql('set'); | ||
expect(command.args.length).to.eql(2); | ||
command = c.callBuffer('set', 'foo', 'bar', function () {}); | ||
expect(command.name).to.eql('set'); | ||
expect(command.args.length).to.eql(2); | ||
Commander.prototype.sendCommand.restore(); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
170546
55
3921