You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,9 +50,7 @@ This will display:
50
50
1: hashtest 2
51
51
mjr:~/work/node_redis (master)$
52
52
53
-
Note that the API is entire asynchronous. To get data back from the server,
54
-
you'll need to use a callback. The return value from most of the API is a
55
-
backpressure indicator.
53
+
Note that the API is entire asynchronous. To get data back from the server, you'll need to use a callback.
56
54
57
55
### Promises
58
56
@@ -115,9 +113,8 @@ For a list of Redis commands, see [Redis Command Reference](http://redis.io/comm
115
113
116
114
The commands can be specified in uppercase or lowercase for convenience. `client.get()` is the same as `client.GET()`.
117
115
118
-
Minimal parsing is done on the replies. Commands that return a single line reply return JavaScript Strings,
119
-
integer replies return JavaScript Numbers, "bulk" replies return node Buffers, and "multi bulk" replies return a
120
-
JavaScript Array of node Buffers. `HGETALL` returns an Object with Buffers keyed by the hash keys.
116
+
Minimal parsing is done on the replies. Commands that return a integer return JavaScript Numbers, arrays return JavaScript Array. `HGETALL` returns an Object keyed by the hash keys. All strings will either be returned as string or as buffer depending on your setting.
117
+
Please be aware that sending null, undefined and Boolean values will result in the value coerced to a string!
121
118
122
119
# API
123
120
@@ -173,23 +170,20 @@ port and host are probably fine and you don't need to supply any arguments. `cre
#### `options` is an object with the following possible properties:
180
177
*`host`: *127.0.0.1*; The host to connect to
181
178
*`port`: *6370*; The port to connect to
182
179
*`path`: *null*; The unix socket string to connect to
183
-
*`url`: *null*; The redis url to connect to
180
+
*`url`: *null*; The redis url to connect to (`[redis:]//[user][:password@][host][:port][/db-number][?db=db-number[&password=bar[&option=value]]]` For more info check [IANA](http://www.iana.org/assignments/uri-schemes/prov/redis))
184
181
*`parser`: *hiredis*; Which Redis protocol reply parser to use. If `hiredis` is not installed it will fallback to `javascript`.
185
182
*`return_buffers`: *false*; If set to `true`, then all replies will be sent to callbacks as Buffers instead of Strings.
186
183
*`detect_buffers`: *false*; If set to `true`, then replies will be sent to callbacks as Buffers. Please be aware that this can't work properly with the pubsub mode. A subscriber has to either always return strings or buffers.
187
184
if any of the input arguments to the original command were Buffers.
188
185
This option lets you switch between Buffers and Strings on a per-command basis, whereas `return_buffers` applies to
189
186
every command on a client.
190
-
*`socket_nodelay`: *true*; Disables the [Nagle algorithm](https://en.wikipedia.org/wiki/Nagle%27s_algorithm).
191
-
Setting this option to `false` can result in additional throughput at the cost of more latency.
192
-
Most applications will want this set to `true`.
193
187
*`socket_keepalive`*true*; Whether the keep-alive functionality is enabled on the underlying socket.
194
188
*`no_ready_check`: *false*; When a connection is established to the Redis server, the server might still
195
189
be loading the database from disk. While loading the server will not respond to any commands. To work around this,
@@ -208,7 +202,9 @@ The value is provided in milliseconds and is counted from the moment on a new cl
208
202
Default is to try connecting until the default system socket timeout has been exceeded and to try reconnecting until 1h passed.
209
203
*`max_attempts`: *0*; By default client will try reconnecting until connected. Setting `max_attempts`
210
204
limits total amount of connection tries. Setting this to 1 will prevent any reconnect tries.
211
-
*`auth_pass`: *null*; If set, client will run redis auth command on connect.
205
+
*`retry_unfulfilled_commands`: *false*; If set to true, all commands that were unfulfulled while the connection is lost will be retried after the connection has reestablished again. Use this with caution, if you use state altering commands (e.g. *incr*). This is especially useful if you use blocking commands.
206
+
*`password`: *null*; If set, client will run redis auth command on connect. Alias `auth_pass`
207
+
*`db`: *null*; If set, client will run redis select command on connect. This is [not recommended](https://groups.google.com/forum/#!topic/redis-db/vS5wX8X4Cjg).
212
208
*`family`: *IPv4*; You can force using IPv6 if you set the family to 'IPv6'. See Node.js [net](https://nodejs.org/api/net.html) or [dns](https://nodejs.org/api/dns.html) modules how to use the family type.
213
209
*`disable_resubscribing`: *false*; If set to `true`, a client won't resubscribe after disconnecting
214
210
*`rename_commands`: *null*; pass a object with renamed commands to use those instead of the original functions. See the [redis security topics](http://redis.io/topics/security) for more info.
@@ -245,12 +241,13 @@ NOTE: Your call to `client.auth()` should not be inside the ready handler. If
245
241
you are doing this wrong, `client` will emit an error that looks
246
242
something like this `Error: Ready check failed: ERR operation not permitted`.
247
243
248
-
## client.end([flush])
244
+
## client.end(flush)
249
245
250
246
Forcibly close the connection to the Redis server. Note that this does not wait until all replies have been parsed.
251
247
If you want to exit cleanly, call `client.quit()` to send the `QUIT` command after you have handled all replies.
252
248
253
-
If flush is set to true, all still running commands will be rejected instead of ignored after using `.end`.
249
+
You should set flush to true, if you are not absolutly sure you do not care about any other commands.
250
+
If you set flush to false all still running commands will silently fail.
254
251
255
252
This example closes the connection to the Redis server before the replies have been read. You probably don't
Copy file name to clipboardExpand all lines: changelog.md
+36-3Lines changed: 36 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,45 @@
1
1
Changelog
2
2
=========
3
3
4
-
## v.2.5.0 - xx Dez, 2015
4
+
## v.2.5.0-0 - xx Dez, 2015
5
5
6
6
Features
7
7
8
-
- The parsers moved into the [redis-parser](https://github.com/NodeRedis/node-redis-parser) module and will be maintained in there from now on ([@BridgeAR](https://github.com/BridgeAR))
9
-
- Improve js parser speed significantly for big SUNION/SINTER/LRANGE/ZRANGE ([@BridgeAR](https://github.com/BridgeAR))
8
+
- The parsers moved into the [redis-parser](https://github.com/NodeRedis/node-redis-parser) module and will be maintained in there from now on
9
+
- Improve js parser speed significantly for big SUNION/SINTER/LRANGE/ZRANGE
10
+
- Improve redis-url parsing to also accept the database-number and options as query parameters as suggested in the [IANA](http://www.iana.org/assignments/uri-schemes/prov/redis)
11
+
- Added a `retry_unfulfilled_commands` option
12
+
- Setting this to 'true' results in retrying all commands that were not fulfilled on a connection loss after the reconnect. Use with caution
13
+
- Added a `db` option to select the database while connecting (this is [not recommended](https://groups.google.com/forum/#!topic/redis-db/vS5wX8X4Cjg))
14
+
- Added a `password` option as alias for auth_pass
15
+
- The client.server_info is from now on updated while using the info command
16
+
17
+
Bugfixes
18
+
19
+
- Fixed explicit undefined as a command callback in a multi context
20
+
- Fixed hmset failing to detect the first key as buffer or date if the key is of that type
21
+
- Fixed do not run toString on an array argument and throw a "invalid data" error instead
22
+
- This is not considered as breaking change, as this is likely a error in your code and if you want to have such a behavior you should handle this beforehand
23
+
- The same applies to Map / Set and individual Object types
24
+
- Fixed redis url not accepting the protocol being omitted or protocols other than the redis protocol for convienence
25
+
- Fixed parsing the db keyspace even if the first database does not begin with a zero
26
+
- Fixed handling of errors occuring while receiving pub sub messages
27
+
28
+
Deprecations
29
+
30
+
- Using any command with a argument being set to null or undefined is deprecated
31
+
- From v.3.0.0 on using a command with such an argument will return an error instead
32
+
- If you want to keep the old behavior please use a precheck in your code that converts the arguments to a string.
33
+
- Using SET or SETEX with a undefined or null value will from now on also result in converting the value to "null" / "undefined" to have a consistent behavior. This is not considered as breaking change, as it returned an error earlier.
34
+
- Using .end(flush) without the flush parameter deprecated and the flush parameter should explicitly be used
35
+
- From v.3.0.0 on using .end without flush will result in an error
36
+
- Using .end without flush means that any command that did not yet return is going to silently fail. Therefor this is considered harmfull and you should explicitly silence such errors if you are sure you want this
37
+
- Depending on the return value of a command to detect the backpressure is deprecated
38
+
- From version 3.0.0 on node_redis might not return true / false as a return value anymore. Please rely on client.should_buffer instead
39
+
- The socket_nodelay option is deprecated and will be removed in v.3.0.0
40
+
- If you want to buffer commands you should use [.batch or .multi](./README.md) instead. This is necessary to reduce the amount of different options and this is very likely reducing your throughput if set to false.
41
+
- If you are sure you want to activate the NAGLE algorithm you can still activate it by using client.stream.setNoDelay(false)
42
+
- Redis < v. 2.6.11 is not supported anymore and will not work in all cases. Please update to a newer redis version
0 commit comments