1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

need not send message to server when set undefined value

This commit is contained in:
继风
2013-03-17 18:05:39 +08:00
parent 1ba5864a20
commit 78d8f9ef9c
2 changed files with 10 additions and 0 deletions

View File

@@ -694,6 +694,14 @@ RedisClient.prototype.send_command = function (command, args, callback) {
args = args.slice(0, -1).concat(args[args.length - 1]);
}
// if the value is undefined or null and command is set or setx, need not to send message to redis
if (command === 'set' || command === 'setex') {
if(args[args.length - 1] === undefined || args[args.length - 1] === null) {
var err = new Error('send_command: ' + command + ' value must not be undefined or null');
return callback(err);
}
}
buffer_args = false;
for (i = 0, il = args.length, arg; i < il; i += 1) {
if (Buffer.isBuffer(args[i])) {