You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Add duplicate function to duplicate the current client instance
Fixes #919
This commit is contained in:
9
index.js
9
index.js
@@ -135,6 +135,15 @@ RedisClient.prototype.create_stream = function () {
|
||||
RedisClient.prototype.cork = noop;
|
||||
RedisClient.prototype.uncork = noop;
|
||||
|
||||
RedisClient.prototype.duplicate = function (options) {
|
||||
var existing_options = clone(this.options);
|
||||
options = clone(options);
|
||||
for (var elem in options) { // jshint ignore: line
|
||||
existing_options[elem] = options[elem];
|
||||
}
|
||||
return new RedisClient(existing_options);
|
||||
};
|
||||
|
||||
RedisClient.prototype.initialize_retry_vars = function () {
|
||||
this.retry_timer = null;
|
||||
this.retry_totaltime = 0;
|
||||
|
Reference in New Issue
Block a user