redis 2.6.2 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -1
- package/changelog.md +7 -0
- package/index.js +4 -4
- package/lib/utils.js +4 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ redis - a node.js redis client
|
|
|
6
6
|
[](https://ci.appveyor.com/project/BridgeAR/node-redis/branch/master)
|
|
7
7
|
[](https://gitter.im/NodeRedis/node_redis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
|
8
8
|
|
|
9
|
-
This is a complete and feature rich Redis client for node.js.
|
|
9
|
+
This is a complete and feature rich Redis client for node.js. __It supports all Redis commands__ and focuses on high performance.
|
|
10
10
|
|
|
11
11
|
Install with:
|
|
12
12
|
|
|
@@ -658,6 +658,33 @@ the second word as first parameter:
|
|
|
658
658
|
Duplicate all current options and return a new redisClient instance. All options passed to the duplicate function are going to replace the original option.
|
|
659
659
|
If you pass a callback, duplicate is going to wait until the client is ready and returns it in the callback. If an error occurs in the meanwhile, that is going to return an error instead in the callback.
|
|
660
660
|
|
|
661
|
+
One example of when to use duplicate() would be to accomodate the connection-
|
|
662
|
+
blocking redis commands BRPOP, BLPOP, and BRPOPLPUSH. If these commands
|
|
663
|
+
are used on the same redisClient instance as non-blocking commands, the
|
|
664
|
+
non-blocking ones may be queued up until after the blocking ones finish.
|
|
665
|
+
|
|
666
|
+
var Redis=require('redis');
|
|
667
|
+
var client = Redis.createClient();
|
|
668
|
+
var clientBlocking = client.duplicate();
|
|
669
|
+
|
|
670
|
+
var get = function() {
|
|
671
|
+
console.log("get called");
|
|
672
|
+
client.get("any_key",function() { console.log("get returned"); });
|
|
673
|
+
setTimeout( get, 1000 );
|
|
674
|
+
};
|
|
675
|
+
var brpop = function() {
|
|
676
|
+
console.log("brpop called");
|
|
677
|
+
clientBlocking.brpop("nonexistent", 5, function() {
|
|
678
|
+
console.log("brpop return");
|
|
679
|
+
setTimeout( brpop, 1000 );
|
|
680
|
+
});
|
|
681
|
+
};
|
|
682
|
+
get();
|
|
683
|
+
brpop();
|
|
684
|
+
|
|
685
|
+
Another reason to use duplicate() is when multiple DBs on the same server are
|
|
686
|
+
accessed via the redis SELECT command. Each DB could use its own connection.
|
|
687
|
+
|
|
661
688
|
## client.send_command(command_name[, [args][, callback]])
|
|
662
689
|
|
|
663
690
|
All Redis commands have been added to the `client` object. However, if new commands are introduced before this library is updated,
|
package/changelog.md
CHANGED
package/index.js
CHANGED
|
@@ -868,16 +868,16 @@ RedisClient.prototype.internal_send_command = function (command_obj) {
|
|
|
868
868
|
var big_data = false;
|
|
869
869
|
var args_copy = new Array(len);
|
|
870
870
|
|
|
871
|
+
if (process.domain && command_obj.callback) {
|
|
872
|
+
command_obj.callback = process.domain.bind(command_obj.callback);
|
|
873
|
+
}
|
|
874
|
+
|
|
871
875
|
if (this.ready === false || this.stream.writable === false) {
|
|
872
876
|
// Handle offline commands right away
|
|
873
877
|
handle_offline_command(this, command_obj);
|
|
874
878
|
return false; // Indicate buffering
|
|
875
879
|
}
|
|
876
880
|
|
|
877
|
-
if (process.domain && command_obj.callback) {
|
|
878
|
-
command_obj.callback = process.domain.bind(command_obj.callback);
|
|
879
|
-
}
|
|
880
|
-
|
|
881
881
|
for (i = 0; i < len; i += 1) {
|
|
882
882
|
if (typeof args[i] === 'string') {
|
|
883
883
|
// 30000 seemed to be a good value to switch to buffers after testing and checking the pros and cons
|
package/lib/utils.js
CHANGED
|
@@ -57,6 +57,10 @@ function clone (obj) {
|
|
|
57
57
|
var elems = Object.keys(obj);
|
|
58
58
|
var elem;
|
|
59
59
|
while (elem = elems.pop()) {
|
|
60
|
+
if (elem === 'tls') { // special handle tls
|
|
61
|
+
copy[elem] = obj[elem];
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
60
64
|
// Accept camelCase options and convert them to snake_case
|
|
61
65
|
var snake_case = elem.replace(/[A-Z][^A-Z]/g, '_$&').toLowerCase();
|
|
62
66
|
// If camelCase is detected, pass it to the client, so all variables are going to be camelCased
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redis",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3",
|
|
4
4
|
"description": "Redis client library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"database",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"eslint": "^2.5.0",
|
|
40
40
|
"metrics": "^0.1.9",
|
|
41
41
|
"mocha": "^2.3.2",
|
|
42
|
-
"nyc": "^
|
|
42
|
+
"nyc": "^8.3.0",
|
|
43
43
|
"tcp-port-used": "^0.1.2",
|
|
44
44
|
"uuid": "^2.0.1",
|
|
45
45
|
"win-spawn": "^2.0.0"
|