You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Minor improvement for .batch and .multi for small values
Improve the speed by round about 5% for small values Add Multi.exec_atomic
This commit is contained in:
@@ -385,6 +385,41 @@ describe("The 'multi' method", function () {
|
||||
client.get('foo', helper.isString('bar', done));
|
||||
});
|
||||
|
||||
it("should not use a transaction with exec_atomic if only no command is used", function () {
|
||||
var multi = client.multi();
|
||||
var test = false;
|
||||
multi.exec_batch = function () {
|
||||
test = true;
|
||||
};
|
||||
multi.exec_atomic();
|
||||
assert(test);
|
||||
});
|
||||
|
||||
it("should not use a transaction with exec_atomic if only one command is used", function () {
|
||||
var multi = client.multi();
|
||||
var test = false;
|
||||
multi.exec_batch = function () {
|
||||
test = true;
|
||||
};
|
||||
multi.set("baz", "binary");
|
||||
multi.exec_atomic();
|
||||
assert(test);
|
||||
});
|
||||
|
||||
it("should use transaction with exec_atomic and more than one command used", function (done) {
|
||||
helper.serverVersionAtLeast.call(this, client, [2, 6, 5]);
|
||||
|
||||
var multi = client.multi();
|
||||
var test = false;
|
||||
multi.exec_batch = function () {
|
||||
test = true;
|
||||
};
|
||||
multi.set("baz", "binary");
|
||||
multi.get('baz');
|
||||
multi.exec_atomic(done);
|
||||
assert(!test);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user