|
|
@ -25,7 +25,8 @@ RedisClient.prototype.batch = RedisClient.prototype.BATCH = function batch (args |
|
|
|
// Store db in this.select_db to restore it on reconnect
|
|
|
|
RedisClient.prototype.select = RedisClient.prototype.SELECT = function select (db, callback) { |
|
|
|
var self = this; |
|
|
|
return this.send_command('select', [db], function (err, res) { |
|
|
|
db = Array.isArray(db) && db.length === 1 ? db[0] : db; |
|
|
|
return this.internal_send_command('select', [db], function (err, res) { |
|
|
|
if (err === null) { |
|
|
|
self.selected_db = db; |
|
|
|
} |
|
|
@ -36,7 +37,7 @@ RedisClient.prototype.select = RedisClient.prototype.SELECT = function select (d |
|
|
|
RedisClient.prototype.monitor = RedisClient.prototype.MONITOR = function (callback) { |
|
|
|
// Use a individual command, as this is a special case that does not has to be checked for any other command
|
|
|
|
var self = this; |
|
|
|
return this.send_command('monitor', [], function (err, res) { |
|
|
|
return this.internal_send_command('monitor', [], function (err, res) { |
|
|
|
if (err === null) { |
|
|
|
self.reply_parser.returnReply = function (reply) { |
|
|
|
// If in monitor mode, all normal commands are still working and we only want to emit the streamlined commands
|
|
|
@ -86,7 +87,7 @@ RedisClient.prototype.quit = RedisClient.prototype.QUIT = function (callback) { |
|
|
|
} |
|
|
|
utils.callback_or_emit(self, callback, err, res); |
|
|
|
}; |
|
|
|
var backpressure_indicator = this.send_command('quit', [], callback_hook); |
|
|
|
var backpressure_indicator = this.internal_send_command('quit', [], callback_hook); |
|
|
|
// Calling quit should always end the connection, no matter if there's a connection or not
|
|
|
|
this.closing = true; |
|
|
|
return backpressure_indicator; |
|
|
@ -103,7 +104,7 @@ RedisClient.prototype.info = RedisClient.prototype.INFO = function info (section |
|
|
|
args = Array.isArray(section) ? section : [section]; |
|
|
|
} |
|
|
|
this.ready = ready || this.offline_queue.length === 0; // keep the execution order intakt
|
|
|
|
var tmp = this.send_command('info', args, function (err, res) { |
|
|
|
var tmp = this.internal_send_command('info', args, function (err, res) { |
|
|
|
if (res) { |
|
|
|
var obj = {}; |
|
|
|
var lines = res.toString().split('\r\n'); |
|
|
@ -148,9 +149,10 @@ RedisClient.prototype.auth = RedisClient.prototype.AUTH = function auth (pass, c |
|
|
|
debug('Sending auth to ' + self.address + ' id ' + self.connection_id); |
|
|
|
|
|
|
|
// Stash auth for connect and reconnect.
|
|
|
|
pass = Array.isArray(pass) && pass.length === 1 ? pass[0] : pass; |
|
|
|
this.auth_pass = pass; |
|
|
|
this.ready = this.offline_queue.length === 0; // keep the execution order intakt
|
|
|
|
var tmp = this.send_command('auth', [pass], function (err, res) { |
|
|
|
var tmp = this.internal_send_command('auth', [pass], function (err, res) { |
|
|
|
if (err) { |
|
|
|
if (no_password_is_set.test(err.message)) { |
|
|
|
self.warn('Warning: Redis server does not require a password, but a password was supplied.'); |
|
|
@ -207,5 +209,5 @@ RedisClient.prototype.hmset = RedisClient.prototype.HMSET = function hmset () { |
|
|
|
arr[i] = arguments[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
return this.send_command('hmset', arr, callback); |
|
|
|
return this.internal_send_command('hmset', arr, callback); |
|
|
|
}; |
|
|
|