Permalink
Browse files

Fixed MSETNX

  • Loading branch information...
1 parent ce42aba commit 58ad9e977c9a96c0838d58b98551a40196069878 @tj committed Apr 15, 2011
Showing with 6 additions and 10 deletions.
  1. +6 −10 lib/commands/string.js
View
@@ -291,25 +291,21 @@ exports.mset.mutates = true;
*/
exports.msetnx = function(client, strs){
- var key
- , val
- , len = strs.length
- , keys = [];
+ var len = strs.length
+ , keys = []
+ , key
+ , val;
// Ensure none exist
for (var i = 0; i < len; ++i) {
keys[i] = key = string(strs[i++]);
- if (null != this.data[key]) {
- return client.bool(false);
- }
+ if (this.lookup(key)) return client.bool(false);
}
// Perform sets
for (var i = 0; i < len; i += 2) {
key = keys[i];
- val = strs[i];
- this.data[key] = val;
- this.keyType(key, 'string');
+ this.db.data[key] = { type: 'string', val: strs[i] }
}
client.bool(true);

0 comments on commit 58ad9e9

Please sign in to comment.