1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-10 11:43:01 +03:00
This commit is contained in:
Salakar
2020-02-09 02:28:12 +00:00
parent bb05064b14
commit 7ce0858456
3 changed files with 436 additions and 504 deletions

View File

@@ -3,7 +3,7 @@
"trailingComma": "all", "trailingComma": "all",
"useTabs": false, "useTabs": false,
"semi": true, "semi": true,
"singleQuote": true, "singleQuote": false,
"bracketSpacing": true, "bracketSpacing": true,
"jsxBracketSameLine": false, "jsxBracketSameLine": false,
"tabWidth": 2, "tabWidth": 2,

View File

@@ -1,35 +1,35 @@
# Changelog # Changelog
## v.3.0.0 - 09 Feb, 2020 ## v3.0.0 - 09 Feb, 2020
This version is mainly a release to distribute all the unreleased changes on master since 2017 and additionally removes This version is mainly a release to distribute all the unreleased changes on master since 2017 and additionally removes
a lot of old deprecated features and old internals in preparation for an upcoming modernization refactor (v4). a lot of old deprecated features and old internals in preparation for an upcoming modernization refactor (v4).
### Breaking Changes ### Breaking Changes
- Dropped support for Node.js < 6 - Dropped support for Node.js < 6
- Dropped support for `hiredis` (no longer required) - Dropped support for `hiredis` (no longer required)
- Removed previously deprecated `drain` event - Removed previously deprecated `drain` event
- Removed previously deprecated `idle` event - Removed previously deprecated `idle` event
- Removed previously deprecated `parser` option - Removed previously deprecated `parser` option
- Removed previously deprecated `max_delay` option - Removed previously deprecated `max_delay` option
- Removed previously deprecated `max_attempts` option - Removed previously deprecated `max_attempts` option
- Removed previously deprecated `socket_no_delay` option - Removed previously deprecated `socket_no_delay` option
### Bug Fixes ### Bug Fixes
- Removed development files from published package (#1370) - Removed development files from published package (#1370)
- Duplicate function now allows db param to be passed (#1311) - Duplicate function now allows db param to be passed (#1311)
### Features ### Features
- Upgraded to latest `redis-commands` package - Upgraded to latest `redis-commands` package
- Upgraded to latest `redis-parser` package, v3.0.0, which brings performance improvements - Upgraded to latest `redis-parser` package, v3.0.0, which brings performance improvements
- Replaced `double-ended-queue` with `denque`, which brings performance improvements - Replaced `double-ended-queue` with `denque`, which brings performance improvements
- Add timestamps to debug traces - Add timestamps to debug traces
- Add `socket_initial_delay` option for `socket.setKeepAlive` (#1396) - Add `socket_initial_delay` option for `socket.setKeepAlive` (#1396)
## v.2.8.0 - 31 Jul, 2017 ## v2.8.0 - 31 Jul, 2017
Features Features
@@ -42,13 +42,13 @@ Bugfixes
- Fixed emitting internal errors while reconnecting with auth - Fixed emitting internal errors while reconnecting with auth
- Fixed crashing with invalid url option - Fixed crashing with invalid url option
## v.2.7.1 - 14 Mar, 2017 ## v2.7.1 - 14 Mar, 2017
Bugfixes Bugfixes
- Fixed monitor mode not working in combination with IPv6 (2.6.0 regression) - Fixed monitor mode not working in combination with IPv6 (2.6.0 regression)
## v.2.7.0 - 11 Mar, 2017 ## v2.7.0 - 11 Mar, 2017
Features Features
@@ -59,47 +59,47 @@ Bugfixes
- Fixed rename_commands not accepting `null` as value - Fixed rename_commands not accepting `null` as value
- Fixed `AbortError`s and `AggregateError`s not showing the error message in the stack trace - Fixed `AbortError`s and `AggregateError`s not showing the error message in the stack trace
## v.2.6.5 - 15 Jan, 2017 ## v2.6.5 - 15 Jan, 2017
Bugfixes Bugfixes
- Fixed parser not being reset in case the redis connection closed ASAP for overcoming of output buffer limits - Fixed parser not being reset in case the redis connection closed ASAP for overcoming of output buffer limits
- Fixed parser reset if (p)message_buffer listener is attached - Fixed parser reset if (p)message_buffer listener is attached
## v.2.6.4 - 12 Jan, 2017 ## v2.6.4 - 12 Jan, 2017
Bugfixes Bugfixes
- Fixed monitor mode not working in combination with IPv6, sockets or lua scripts (2.6.0 regression) - Fixed monitor mode not working in combination with IPv6, sockets or lua scripts (2.6.0 regression)
## v.2.6.3 - 31 Oct, 2016 ## v2.6.3 - 31 Oct, 2016
Bugfixes Bugfixes
- Do not change the tls setting to camel_case - Do not change the tls setting to camel_case
- Fix domain handling in combination with the offline queue (2.5.3 regression) - Fix domain handling in combination with the offline queue (2.5.3 regression)
## v.2.6.2 - 16 Jun, 2016 ## v2.6.2 - 16 Jun, 2016
Bugfixes Bugfixes
- Fixed individual callbacks of a transaction not being called (2.6.0 regression) - Fixed individual callbacks of a transaction not being called (2.6.0 regression)
## v.2.6.1 - 02 Jun, 2016 ## v2.6.1 - 02 Jun, 2016
Bugfixes Bugfixes
- Fixed invalid function name being exported - Fixed invalid function name being exported
## v.2.6.0 - 01 Jun, 2016 ## v2.6.0 - 01 Jun, 2016
In addition to the pre-releases the following changes exist in v.2.6.0: In addition to the pre-releases the following changes exist in v.2.6.0:
Features Features
- Updated [redis-parser](https://github.com/NodeRedis/node-redis-parser) dependency ([changelog](https://github.com/NodeRedis/node-redis-parser/releases/tag/v.2.0.0)) - Updated [redis-parser](https://github.com/NodeRedis/node-redis-parser) dependency ([changelog](https://github.com/NodeRedis/node-redis-parser/releases/tag/v.2.0.0))
- The JS parser is from now on the new default as it is a lot faster than the hiredis parser - The JS parser is from now on the new default as it is a lot faster than the hiredis parser
- This is no BC as there is no changed behavior for the user at all but just a performance improvement. Explicitly requireing the Hiredis parser is still possible. - This is no BC as there is no changed behavior for the user at all but just a performance improvement. Explicitly requireing the Hiredis parser is still possible.
- Added name property to all Redis functions (Node.js >= 4.0) - Added name property to all Redis functions (Node.js >= 4.0)
- Improved stack traces in development and debug mode - Improved stack traces in development and debug mode
@@ -111,27 +111,27 @@ Deprecations
- The `parser` option is deprecated and should be removed. The built-in Javascript parser is a lot faster than the hiredis parser and has more features - The `parser` option is deprecated and should be removed. The built-in Javascript parser is a lot faster than the hiredis parser and has more features
## v.2.6.0-2 - 29 Apr, 2016 ## v2.6.0-2 - 29 Apr, 2016
Features Features
- Added support for the new [CLIENT REPLY ON|OFF|SKIP](http://redis.io/commands/client-reply) command (Redis v.3.2) - Added support for the new [CLIENT REPLY ON|OFF|SKIP](http://redis.io/commands/client-reply) command (Redis v.3.2)
- Added support for camelCase - Added support for camelCase
- The Node.js landscape default is to use camelCase. node_redis is a bit out of the box here - The Node.js landscape default is to use camelCase. node_redis is a bit out of the box here
but from now on it is possible to use both, just as you prefer! but from now on it is possible to use both, just as you prefer!
- If there's any documented variable missing as camelCased, please open a issue for it - If there's any documented variable missing as camelCased, please open a issue for it
- Improve error handling significantly - Improve error handling significantly
- Only emit an error if the error has not already been handled in a callback - Only emit an error if the error has not already been handled in a callback
- Improved unspecific error messages e.g. "Connection gone from end / close event" - Improved unspecific error messages e.g. "Connection gone from end / close event"
- Added `args` to command errors to improve identification of the error - Added `args` to command errors to improve identification of the error
- Added origin to errors if there's e.g. a connection error - Added origin to errors if there's e.g. a connection error
- Added ReplyError class. All Redis errors are from now on going to be of that class - Added ReplyError class. All Redis errors are from now on going to be of that class
- Added AbortError class. A subclass of AbortError. All unresolved and by node_redis rejected commands are from now on of that class - Added AbortError class. A subclass of AbortError. All unresolved and by node_redis rejected commands are from now on of that class
- Added AggregateError class. If a unresolved and by node_redis rejected command has no callback and - Added AggregateError class. If a unresolved and by node_redis rejected command has no callback and
this applies to more than a single command, the errors for the commands without callback are aggregated this applies to more than a single command, the errors for the commands without callback are aggregated
to a single error that is emitted in debug_mode in that case. to a single error that is emitted in debug_mode in that case.
- Added `message_buffer` / `pmessage_buffer` events. That event is always going to emit a buffer - Added `message_buffer` / `pmessage_buffer` events. That event is always going to emit a buffer
- Listening to the `message` event at the same time is always going to return the same message as string - Listening to the `message` event at the same time is always going to return the same message as string
- Added callback option to the duplicate function - Added callback option to the duplicate function
- Added support for `__proto__` and other reserved keywords as hgetall field - Added support for `__proto__` and other reserved keywords as hgetall field
- Updated [redis-commands](https://github.com/NodeRedis/redis-commands) dependency ([changelog](https://github.com/NodeRedis/redis-commands/releases/tag/v.1.2.0)) - Updated [redis-commands](https://github.com/NodeRedis/redis-commands) dependency ([changelog](https://github.com/NodeRedis/redis-commands/releases/tag/v.1.2.0))
@@ -140,14 +140,14 @@ Bugfixes
- Fixed v.2.5.0 auth command regression (under special circumstances a reconnect would not authenticate properly) - Fixed v.2.5.0 auth command regression (under special circumstances a reconnect would not authenticate properly)
- Fixed v.2.6.0-0 pub sub mode and quit command regressions: - Fixed v.2.6.0-0 pub sub mode and quit command regressions:
- Entering pub sub mode not working if a earlier called and still running command returned an error - Entering pub sub mode not working if a earlier called and still running command returned an error
- Unsubscribe callback not called if unsubscribing from all channels and resubscribing right away - Unsubscribe callback not called if unsubscribing from all channels and resubscribing right away
- Quit command resulting in an error in some cases - Quit command resulting in an error in some cases
- Fixed special handled functions in batch and multi context not working the same as without (e.g. select and info) - Fixed special handled functions in batch and multi context not working the same as without (e.g. select and info)
- Be aware that not all commands work in combination with transactions but they all work with batch - Be aware that not all commands work in combination with transactions but they all work with batch
- Fixed address always set to 127.0.0.1:6379 in case host / port is set in the `tls` options instead of the general options - Fixed address always set to 127.0.0.1:6379 in case host / port is set in the `tls` options instead of the general options
## v.2.6.0-1 - 01 Apr, 2016 ## v2.6.0-1 - 01 Apr, 2016
A second pre-release with further fixes. This is likely going to be released as 2.6.0 stable without further changes. A second pre-release with further fixes. This is likely going to be released as 2.6.0 stable without further changes.
@@ -162,14 +162,14 @@ Bugfixes
- Fixed pub sub mode unsubscribing from all channels not respected while reconnecting - Fixed pub sub mode unsubscribing from all channels not respected while reconnecting
- Fixed pub sub mode events in combination with the `string_numbers` option emitting the number of channels not as number - Fixed pub sub mode events in combination with the `string_numbers` option emitting the number of channels not as number
## v.2.6.0-0 - 27 Mar, 2016 ## v2.6.0-0 - 27 Mar, 2016
This is mainly a very important bug fix release with some smaller features. This is mainly a very important bug fix release with some smaller features.
Features Features
- Monitor and pub sub mode now work together with the offline queue - Monitor and pub sub mode now work together with the offline queue
- All commands that were send after a connection loss are now going to be send after reconnecting - All commands that were send after a connection loss are now going to be send after reconnecting
- Activating monitor mode does now work together with arbitrary commands including pub sub mode - Activating monitor mode does now work together with arbitrary commands including pub sub mode
- Pub sub mode is completely rewritten and all known issues fixed - Pub sub mode is completely rewritten and all known issues fixed
- Added `string_numbers` option to get back strings instead of numbers - Added `string_numbers` option to get back strings instead of numbers
@@ -190,29 +190,29 @@ Bugfixes
The quit command did not end connections earlier if the connection was down at that time and this could have The quit command did not end connections earlier if the connection was down at that time and this could have
lead to strange situations, therefor this was fixed to end the connection right away in those cases. lead to strange situations, therefor this was fixed to end the connection right away in those cases.
## v.2.5.3 - 21 Mar, 2016 ## v2.5.3 - 21 Mar, 2016
Bugfixes Bugfixes
- Revert throwing on invalid data types and print a warning instead - Revert throwing on invalid data types and print a warning instead
## v.2.5.2 - 16 Mar, 2016 ## v2.5.2 - 16 Mar, 2016
Bugfixes Bugfixes
- Fixed breaking changes against Redis 2.4 introduced in 2.5.0 / 2.5.1 - Fixed breaking changes against Redis 2.4 introduced in 2.5.0 / 2.5.1
## v.2.5.1 - 15 Mar, 2016 ## v2.5.1 - 15 Mar, 2016
Bugfixes Bugfixes
- Fixed info command not working anymore with optional section argument - Fixed info command not working anymore with optional section argument
## v.2.5.0 - 15 Mar, 2016 ## v2.5.0 - 15 Mar, 2016
Same changelog as the pre-release Same changelog as the pre-release
## v.2.5.0-1 - 07 Mar, 2016 ## v2.5.0-1 - 07 Mar, 2016
This is a big release with some substantial underlining changes. Therefor this is released as a pre-release and I encourage anyone who's able to, to test this out. This is a big release with some substantial underlining changes. Therefor this is released as a pre-release and I encourage anyone who's able to, to test this out.
@@ -223,10 +223,10 @@ This release is also going to deprecate a couple things to prepare for a future
Features Features
- The parsers moved into the [redis-parser](https://github.com/NodeRedis/node-redis-parser) module and will be maintained in there from now on - The parsers moved into the [redis-parser](https://github.com/NodeRedis/node-redis-parser) module and will be maintained in there from now on
- Improve js parser speed significantly for big SUNION/SINTER/LRANGE/ZRANGE - Improve js parser speed significantly for big SUNION/SINTER/LRANGE/ZRANGE
- Improve redis-url parsing to also accept the database-number and options as query parameters as suggested in [IANA](http://www.iana.org/assignments/uri-schemes/prov/redis) - Improve redis-url parsing to also accept the database-number and options as query parameters as suggested in [IANA](http://www.iana.org/assignments/uri-schemes/prov/redis)
- Added a `retry_unfulfilled_commands` option - Added a `retry_unfulfilled_commands` option
- Setting this to 'true' results in retrying all commands that were not fulfilled on a connection loss after the reconnect. Use with caution - Setting this to 'true' results in retrying all commands that were not fulfilled on a connection loss after the reconnect. Use with caution
- Added a `db` option to select the database while connecting (this is [not recommended](https://groups.google.com/forum/#!topic/redis-db/vS5wX8X4Cjg)) - Added a `db` option to select the database while connecting (this is [not recommended](https://groups.google.com/forum/#!topic/redis-db/vS5wX8X4Cjg))
- Added a `password` option as alias for auth_pass - Added a `password` option as alias for auth_pass
- The client.server_info is from now on updated while using the info command - The client.server_info is from now on updated while using the info command
@@ -234,9 +234,9 @@ Features
- Added a `warning` emitter that receives node_redis warnings like auth not required and deprecation messages - Added a `warning` emitter that receives node_redis warnings like auth not required and deprecation messages
- Added a `retry_strategy` option that replaces all reconnect options - Added a `retry_strategy` option that replaces all reconnect options
- The reconnecting event from now on also receives: - The reconnecting event from now on also receives:
- The error message why the reconnect happened (params.error) - The error message why the reconnect happened (params.error)
- The amount of times the client was connected (params.times_connected) - The amount of times the client was connected (params.times_connected)
- The total reconnecting time since the last time connected (params.total_retry_time) - The total reconnecting time since the last time connected (params.total_retry_time)
- Always respect the command execution order no matter if the reply could be returned sync or not (former exceptions: [#937](https://github.com/NodeRedis/node_redis/issues/937#issuecomment-167525939)) - Always respect the command execution order no matter if the reply could be returned sync or not (former exceptions: [#937](https://github.com/NodeRedis/node_redis/issues/937#issuecomment-167525939))
- redis.createClient is now checking input values stricter and detects more faulty input - redis.createClient is now checking input values stricter and detects more faulty input
- Started refactoring internals into individual modules - Started refactoring internals into individual modules
@@ -247,8 +247,8 @@ Bugfixes
- Fixed explicit undefined as a command callback in a multi context - Fixed explicit undefined as a command callback in a multi context
- Fixed hmset failing to detect the first key as buffer or date if the key is of that type - Fixed hmset failing to detect the first key as buffer or date if the key is of that type
- Fixed do not run toString on an array argument and throw a "invalid data" error instead - Fixed do not run toString on an array argument and throw a "invalid data" error instead
- 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 - 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
- The same applies to Map / Set and individual Object types - The same applies to Map / Set and individual Object types
- Fixed redis url not accepting the protocol being omitted or protocols other than the redis protocol for convenience - Fixed redis url not accepting the protocol being omitted or protocols other than the redis protocol for convenience
- Fixed parsing the db keyspace even if the first database does not begin with a zero - Fixed parsing the db keyspace even if the first database does not begin with a zero
- Fixed handling of errors occurring while receiving pub sub messages - Fixed handling of errors occurring while receiving pub sub messages
@@ -259,17 +259,17 @@ Bugfixes
Deprecations Deprecations
- Using any command with a argument being set to null or undefined is deprecated - Using any command with a argument being set to null or undefined is deprecated
- From v.3.0.0 on using a command with such an argument will return an error instead - From v.3.0.0 on using a command with such an argument will return an error instead
- If you want to keep the old behavior please use a precheck in your code that converts the arguments to a string. - If you want to keep the old behavior please use a precheck in your code that converts the arguments to a string.
- 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. - 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.
- Using .end(flush) without the flush parameter is deprecated and the flush parameter should explicitly be used - Using .end(flush) without the flush parameter is deprecated and the flush parameter should explicitly be used
- From v.3.0.0 on using .end without flush will result in an error - From v.3.0.0 on using .end without flush will result in an error
- Using .end without flush means that any command that did not yet return is going to silently fail. Therefor this is considered harmful and you should explicitly silence such errors if you are sure you want this - Using .end without flush means that any command that did not yet return is going to silently fail. Therefor this is considered harmful and you should explicitly silence such errors if you are sure you want this
- Depending on the return value of a command to detect the backpressure is deprecated - Depending on the return value of a command to detect the backpressure is deprecated
- 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 - 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
- The `socket_nodelay` option is deprecated and will be removed in v.3.0.0 - The `socket_nodelay` option is deprecated and will be removed in v.3.0.0
- 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. - 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.
- If you are sure you want to activate the NAGLE algorithm you can still activate it by using client.stream.setNoDelay(false) - If you are sure you want to activate the NAGLE algorithm you can still activate it by using client.stream.setNoDelay(false)
- The `max_attempts` option is deprecated and will be removed in v.3.0.0. Please use the `retry_strategy` instead - The `max_attempts` option is deprecated and will be removed in v.3.0.0. Please use the `retry_strategy` instead
- The `retry_max_delay` option is deprecated and will be removed in v.3.0.0. Please use the `retry_strategy` instead - The `retry_max_delay` option is deprecated and will be removed in v.3.0.0. Please use the `retry_strategy` instead
- The drain event is deprecated and will be removed in v.3.0.0. Please listen to the stream drain event instead - The drain event is deprecated and will be removed in v.3.0.0. Please listen to the stream drain event instead
@@ -277,19 +277,19 @@ Deprecations
- Redis < v. 2.6 is not officially supported anymore and might not work in all cases. Please update to a newer redis version as it is not possible to test for these old versions - Redis < v. 2.6 is not officially supported anymore and might not work in all cases. Please update to a newer redis version as it is not possible to test for these old versions
- Removed non documented command syntax (adding the callback to an arguments array instead of passing it as individual argument) - Removed non documented command syntax (adding the callback to an arguments array instead of passing it as individual argument)
## v.2.4.2 - 27 Nov, 2015 ## v2.4.2 - 27 Nov, 2015
Bugfixes Bugfixes
- Fixed not emitting ready after reconnect with disable_resubscribing ([@maxgalbu](https://github.com/maxgalbu)) - Fixed not emitting ready after reconnect with disable_resubscribing ([@maxgalbu](https://github.com/maxgalbu))
## v.2.4.1 - 25 Nov, 2015 ## v2.4.1 - 25 Nov, 2015
Bugfixes Bugfixes
- Fixed a js parser regression introduced in 2.4.0 ([@BridgeAR](https://github.com/BridgeAR)) - Fixed a js parser regression introduced in 2.4.0 ([@BridgeAR](https://github.com/BridgeAR))
## v.2.4.0 - 25 Nov, 2015 ## v2.4.0 - 25 Nov, 2015
Features Features
@@ -302,28 +302,28 @@ Features
Bugfixes Bugfixes
- Fixed js parser handling big values slow ([@BridgeAR](https://github.com/BridgeAR)) - Fixed js parser handling big values slow ([@BridgeAR](https://github.com/BridgeAR))
- The speed is now on par with the hiredis parser. - The speed is now on par with the hiredis parser.
## v.2.3.1 - 18 Nov, 2015 ## v2.3.1 - 18 Nov, 2015
Bugfixes Bugfixes
- Fixed saving buffers with charsets other than utf-8 while using multi ([@BridgeAR](https://github.com/BridgeAR)) - Fixed saving buffers with charsets other than utf-8 while using multi ([@BridgeAR](https://github.com/BridgeAR))
- Fixed js parser handling big values very slow ([@BridgeAR](https://github.com/BridgeAR)) - Fixed js parser handling big values very slow ([@BridgeAR](https://github.com/BridgeAR))
- The speed is up to ~500% faster than before but still up to ~50% slower than the hiredis parser. - The speed is up to ~500% faster than before but still up to ~50% slower than the hiredis parser.
## v.2.3.0 - 30 Oct, 2015 ## v2.3.0 - 30 Oct, 2015
Features Features
- Improve speed further for: ([@BridgeAR](https://github.com/BridgeAR)) - Improve speed further for: ([@BridgeAR](https://github.com/BridgeAR))
- saving big strings (up to +300%) - saving big strings (up to +300%)
- using .multi / .batch (up to +50% / on Node.js 0.10.x +300%) - using .multi / .batch (up to +50% / on Node.js 0.10.x +300%)
- saving small buffers - saving small buffers
- Increased coverage to 99% ([@BridgeAR](https://github.com/BridgeAR)) - Increased coverage to 99% ([@BridgeAR](https://github.com/BridgeAR))
- Refactored manual backpressure control ([@BridgeAR](https://github.com/BridgeAR)) - Refactored manual backpressure control ([@BridgeAR](https://github.com/BridgeAR))
- Removed the high water mark and low water mark. Such a mechanism should be implemented by a user instead - Removed the high water mark and low water mark. Such a mechanism should be implemented by a user instead
- The `drain` event is from now on only emitted if the stream really had to buffer - The `drain` event is from now on only emitted if the stream really had to buffer
- Reduced the default connect_timeout to be one hour instead of 24h ([@BridgeAR](https://github.com/BridgeAR)) - Reduced the default connect_timeout to be one hour instead of 24h ([@BridgeAR](https://github.com/BridgeAR))
- Added .path to redis.createClient(options); ([@BridgeAR](https://github.com/BridgeAR)) - Added .path to redis.createClient(options); ([@BridgeAR](https://github.com/BridgeAR))
- Ignore info command, if not available on server ([@ivanB1975](https://github.com/ivanB1975)) - Ignore info command, if not available on server ([@ivanB1975](https://github.com/ivanB1975))
@@ -336,13 +336,13 @@ Bugfixes
- Fixed connect_timeout not respected if no connection has ever been established ([@gagle](https://github.com/gagle) & [@benjie](https://github.com/benjie)) - Fixed connect_timeout not respected if no connection has ever been established ([@gagle](https://github.com/gagle) & [@benjie](https://github.com/benjie))
- Fixed return_buffers in pub sub mode ([@komachi](https://github.com/komachi)) - Fixed return_buffers in pub sub mode ([@komachi](https://github.com/komachi))
## v.2.2.5 - 18 Oct, 2015 ## v2.2.5 - 18 Oct, 2015
Bugfixes Bugfixes
- Fixed undefined options passed to a new instance not accepted (possible with individual .createClient functions) ([@BridgeAR](https://github.com/BridgeAR)) - Fixed undefined options passed to a new instance not accepted (possible with individual .createClient functions) ([@BridgeAR](https://github.com/BridgeAR))
## v.2.2.4 - 17 Oct, 2015 ## v2.2.4 - 17 Oct, 2015
Bugfixes Bugfixes
@@ -353,23 +353,23 @@ Bugfixes
- Fixed mutation of the options object passed to createClient ([@BridgeAR](https://github.com/BridgeAR)) - Fixed mutation of the options object passed to createClient ([@BridgeAR](https://github.com/BridgeAR))
- Fixed error callback in .multi not called if connection in broken mode ([@BridgeAR](https://github.com/BridgeAR)) - Fixed error callback in .multi not called if connection in broken mode ([@BridgeAR](https://github.com/BridgeAR))
## v.2.2.3 - 14 Oct, 2015 ## v2.2.3 - 14 Oct, 2015
Bugfixes Bugfixes
- Fixed multi not being executed on Node 0.10.x if node_redis not yet ready ([@BridgeAR](https://github.com/BridgeAR)) - Fixed multi not being executed on Node 0.10.x if node_redis not yet ready ([@BridgeAR](https://github.com/BridgeAR))
## v.2.2.2 - 14 Oct, 2015 ## v2.2.2 - 14 Oct, 2015
Bugfixes Bugfixes
- Fixed regular commands not being executed after a .multi until .exec was called ([@BridgeAR](https://github.com/BridgeAR)) - Fixed regular commands not being executed after a .multi until .exec was called ([@BridgeAR](https://github.com/BridgeAR))
## v.2.2.1 - 12 Oct, 2015 ## v2.2.1 - 12 Oct, 2015
No code change No code change
## v.2.2.0 - 12 Oct, 2015 - The peregrino falcon ## v2.2.0 - 12 Oct, 2015 - The peregrino falcon
The peregrino falcon is the fasted bird on earth and this is what this release is all about: Increased performance for heavy usage by up to **400%** [sic!] and increased overall performance for any command as well. Please check the benchmarks in the [README.md](README.md) for further details. The peregrino falcon is the fasted bird on earth and this is what this release is all about: Increased performance for heavy usage by up to **400%** [sic!] and increased overall performance for any command as well. Please check the benchmarks in the [README.md](README.md) for further details.
@@ -378,16 +378,16 @@ Features
- Added rename_commands options to handle renamed commands from the redis config ([@digmxl](https://github.com/digmxl) & [@BridgeAR](https://github.com/BridgeAR)) - Added rename_commands options to handle renamed commands from the redis config ([@digmxl](https://github.com/digmxl) & [@BridgeAR](https://github.com/BridgeAR))
- Added disable_resubscribing option to prevent a client from resubscribing after reconnecting ([@BridgeAR](https://github.com/BridgeAR)) - Added disable_resubscribing option to prevent a client from resubscribing after reconnecting ([@BridgeAR](https://github.com/BridgeAR))
- Increased performance ([@BridgeAR](https://github.com/BridgeAR)) - Increased performance ([@BridgeAR](https://github.com/BridgeAR))
- exchanging built in queue with [@petkaantonov](https://github.com/petkaantonov)'s [double-ended queue](https://github.com/petkaantonov/deque) - exchanging built in queue with [@petkaantonov](https://github.com/petkaantonov)'s [double-ended queue](https://github.com/petkaantonov/deque)
- prevent polymorphism - prevent polymorphism
- optimize statements - optimize statements
- Added *.batch* command, similar to .multi but without transaction ([@BridgeAR](https://github.com/BridgeAR)) - Added _.batch_ command, similar to .multi but without transaction ([@BridgeAR](https://github.com/BridgeAR))
- Improved pipelining to minimize the [RTT](http://redis.io/topics/pipelining) further ([@BridgeAR](https://github.com/BridgeAR)) - Improved pipelining to minimize the [RTT](http://redis.io/topics/pipelining) further ([@BridgeAR](https://github.com/BridgeAR))
Bugfixes Bugfixes
- Fixed a javascript parser regression introduced in 2.0 that could result in timeouts on high load. ([@BridgeAR](https://github.com/BridgeAR)) - Fixed a javascript parser regression introduced in 2.0 that could result in timeouts on high load. ([@BridgeAR](https://github.com/BridgeAR))
- I was not able to write a regression test for this, since the error seems to only occur under heavy load with special conditions. So please have a look for timeouts with the js parser, if you use it and report all issues and switch to the hiredis parser in the meanwhile. If you're able to come up with a reproducable test case, this would be even better :) - I was not able to write a regression test for this, since the error seems to only occur under heavy load with special conditions. So please have a look for timeouts with the js parser, if you use it and report all issues and switch to the hiredis parser in the meanwhile. If you're able to come up with a reproducable test case, this would be even better :)
- Fixed should_buffer boolean for .exec, .select and .auth commands not being returned and fix a couple special conditions ([@BridgeAR](https://github.com/BridgeAR)) - Fixed should_buffer boolean for .exec, .select and .auth commands not being returned and fix a couple special conditions ([@BridgeAR](https://github.com/BridgeAR))
If you do not rely on transactions but want to reduce the RTT you can use .batch from now on. It'll behave just the same as .multi but it does not have any transaction and therefor won't roll back any failed commands.<br> If you do not rely on transactions but want to reduce the RTT you can use .batch from now on. It'll behave just the same as .multi but it does not have any transaction and therefor won't roll back any failed commands.<br>
@@ -473,7 +473,7 @@ This is the biggest release that node_redis had since it was released in 2010. A
- Added: Network errors and other stream errors will from now on include the error code as `err.code` property (@BridgeAR) - Added: Network errors and other stream errors will from now on include the error code as `err.code` property (@BridgeAR)
- Added: Errors thrown by redis will now include the redis error code as `err.code` property. (@skeggse & @BridgeAR) - Added: Errors thrown by redis will now include the redis error code as `err.code` property. (@skeggse & @BridgeAR)
- Added: Errors thrown by node_redis will now include a `err.command` property for the command used (@BridgeAR) - Added: Errors thrown by node_redis will now include a `err.command` property for the command used (@BridgeAR)
- Added new commands and drop support for deprecated *substr* (@BridgeAR) - Added new commands and drop support for deprecated _substr_ (@BridgeAR)
- Added new possibilities how to provide the command arguments (@BridgeAR) - Added new possibilities how to provide the command arguments (@BridgeAR)
- The entries in the keyspace of the server_info is now an object instead of a string. (@SinisterLight & @BridgeAR) - The entries in the keyspace of the server_info is now an object instead of a string. (@SinisterLight & @BridgeAR)
- Small speedup here and there (e.g. by not using .toLowerCase() anymore) (@BridgeAR) - Small speedup here and there (e.g. by not using .toLowerCase() anymore) (@BridgeAR)
@@ -482,7 +482,7 @@ This is the biggest release that node_redis had since it was released in 2010. A
- Remove dead code, clean up and refactor very old chunks (@BridgeAR) - Remove dead code, clean up and refactor very old chunks (@BridgeAR)
- Don't flush the offline queue if reconnecting (@BridgeAR) - Don't flush the offline queue if reconnecting (@BridgeAR)
- Emit all errors insteaf of throwing sometimes and sometimes emitting them (@BridgeAR) - Emit all errors insteaf of throwing sometimes and sometimes emitting them (@BridgeAR)
- *auth_pass* passwords are now checked to be a valid password (@jcppman & @BridgeAR) - _auth_pass_ passwords are now checked to be a valid password (@jcppman & @BridgeAR)
## Bug fixes: ## Bug fixes:
@@ -512,11 +512,13 @@ This is the biggest release that node_redis had since it was released in 2010. A
2. Error messages have changed quite a bit. If you depend on a specific wording please check your application carfully. 2. Error messages have changed quite a bit. If you depend on a specific wording please check your application carfully.
3. Errors are from now on always either returned if a callback is present or emitted. They won't be thrown (neither sync, nor async). 3. Errors are from now on always either returned if a callback is present or emitted. They won't be thrown (neither sync, nor async).
4. The Multi error handling has changed a lot! 4. The Multi error handling has changed a lot!
- All errors are from now on errors instead of strings (this only applied to the js parser).
- If an error occurs while queueing the commands an EXECABORT error will be returned including the failed commands as `.errors` property instead of an array with errors. - All errors are from now on errors instead of strings (this only applied to the js parser).
- If an error occurs while executing the commands and that command has a callback it'll return the error as first parameter (`err, undefined` instead of `null, undefined`). - If an error occurs while queueing the commands an EXECABORT error will be returned including the failed commands as `.errors` property instead of an array with errors.
- All the errors occuring while executing the commands will stay in the result value as error instance (if you used the js parser before they would have been strings). Be aware that the transaction won't be aborted if those error occurr! - If an error occurs while executing the commands and that command has a callback it'll return the error as first parameter (`err, undefined` instead of `null, undefined`).
- If `multi.exec` does not have a callback and an EXECABORT error occurrs, it'll emit that error instead. - All the errors occuring while executing the commands will stay in the result value as error instance (if you used the js parser before they would have been strings). Be aware that the transaction won't be aborted if those error occurr!
- If `multi.exec` does not have a callback and an EXECABORT error occurrs, it'll emit that error instead.
5. If redis can't connect to your redis server it'll give up after a certain point of failures (either max connection attempts or connection timeout exceeded). If that is the case it'll emit an CONNECTION_BROKEN error. You'll have to initiate a new client to try again afterwards. 5. If redis can't connect to your redis server it'll give up after a certain point of failures (either max connection attempts or connection timeout exceeded). If that is the case it'll emit an CONNECTION_BROKEN error. You'll have to initiate a new client to try again afterwards.
6. The offline queue is not flushed anymore on a reconnect. It'll stay until node_redis gives up trying to reach the server or until you close the connection. 6. The offline queue is not flushed anymore on a reconnect. It'll stay until node_redis gives up trying to reach the server or until you close the connection.
7. Before this release node_redis catched user errors and threw them async back. This is not the case anymore! No user behavior of what so ever will be tracked or catched. 7. Before this release node_redis catched user errors and threw them async back. This is not the case anymore! No user behavior of what so ever will be tracked or catched.
@@ -530,110 +532,113 @@ From now on we'll push new releases more frequently out and fix further long out
## v1.0.0 - Aug 30, 2015 ## v1.0.0 - Aug 30, 2015
* Huge issue and pull-request cleanup. Thanks Blain! (@blainsmith) - Huge issue and pull-request cleanup. Thanks Blain! (@blainsmith)
* [#658](https://github.com/NodeRedis/node_redis/pull/658) Client now parses URL-format connection strings (e.g., redis://foo:pass@127.0.0.1:8080) (@kuwabarahiroshi) - [#658](https://github.com/NodeRedis/node_redis/pull/658) Client now parses URL-format connection strings (e.g., redis://foo:pass@127.0.0.1:8080) (@kuwabarahiroshi)
* [#749](https://github.com/NodeRedis/node_redis/pull/749) Fix reconnection bug when client is in monitoring mode (@danielbprice) - [#749](https://github.com/NodeRedis/node_redis/pull/749) Fix reconnection bug when client is in monitoring mode (@danielbprice)
* [#786](https://github.com/NodeRedis/node_redis/pull/786) Refactor createClient. Fixes #651 (@BridgeAR) - [#786](https://github.com/NodeRedis/node_redis/pull/786) Refactor createClient. Fixes #651 (@BridgeAR)
* [#793](https://github.com/NodeRedis/node_redis/pull/793) Refactor tests and improve test coverage (@erinspice, @bcoe) - [#793](https://github.com/NodeRedis/node_redis/pull/793) Refactor tests and improve test coverage (@erinspice, @bcoe)
* [#733](https://github.com/NodeRedis/node_redis/pull/733) Fixes detect_buffers functionality in the context of exec. Fixes #732, #263 (@raydog) - [#733](https://github.com/NodeRedis/node_redis/pull/733) Fixes detect_buffers functionality in the context of exec. Fixes #732, #263 (@raydog)
* [#785](https://github.com/NodeRedis/node_redis/pull/785) Tiny speedup by using 'use strict' (@BridgeAR) - [#785](https://github.com/NodeRedis/node_redis/pull/785) Tiny speedup by using 'use strict' (@BridgeAR)
* Fix extraneous error output due to pubsub tests (Mikael Kohlmyr) - Fix extraneous error output due to pubsub tests (Mikael Kohlmyr)
## v0.12.1 - Aug 10, 2014 ## v0.12.1 - Aug 10, 2014
* Fix IPv6/IPv4 family selection in node 0.11+ (Various)
- Fix IPv6/IPv4 family selection in node 0.11+ (Various)
## v0.12.0 - Aug 9, 2014 ## v0.12.0 - Aug 9, 2014
* Fix unix socket support (Jack Tang)
* Improve createClient argument handling (Jack Tang) - Fix unix socket support (Jack Tang)
- Improve createClient argument handling (Jack Tang)
## v0.11.0 - Jul 10, 2014 ## v0.11.0 - Jul 10, 2014
* IPv6 Support. (Yann Stephan) - IPv6 Support. (Yann Stephan)
* Revert error emitting and go back to throwing errors. (Bryce Baril) - Revert error emitting and go back to throwing errors. (Bryce Baril)
* Set socket_keepalive to prevent long-lived client timeouts. (mohit) - Set socket_keepalive to prevent long-lived client timeouts. (mohit)
* Correctly reset retry timer. (ouotuo) - Correctly reset retry timer. (ouotuo)
* Domains protection from bad user exit. (Jake Verbaten) - Domains protection from bad user exit. (Jake Verbaten)
* Fix reconnection socket logic to prevent misqueued entries. (Iain Proctor) - Fix reconnection socket logic to prevent misqueued entries. (Iain Proctor)
## v0.10.3 - May 22, 2014 ## v0.10.3 - May 22, 2014
* Update command list to match Redis 2.8.9 (Charles Feng) - Update command list to match Redis 2.8.9 (Charles Feng)
## v0.10.2 - May 18, 2014 ## v0.10.2 - May 18, 2014
* Better binary key handling for HGETALL. (Nick Apperson) - Better binary key handling for HGETALL. (Nick Apperson)
* Fix test not resetting `error` handler. (CrypticSwarm) - Fix test not resetting `error` handler. (CrypticSwarm)
* Fix SELECT error semantics. (Bryan English) - Fix SELECT error semantics. (Bryan English)
## v0.10.1 - February 17, 2014 ## v0.10.1 - February 17, 2014
* Skip plucking redis version from the INFO stream if INFO results weren't provided. (Robert Sköld) - Skip plucking redis version from the INFO stream if INFO results weren't provided. (Robert Sköld)
## v0.10.0 - December 21, 2013 ## v0.10.0 - December 21, 2013
* Instead of throwing errors asynchronously, emit errors on client. (Bryce Baril) - Instead of throwing errors asynchronously, emit errors on client. (Bryce Baril)
## v0.9.2 - December 15, 2013 ## v0.9.2 - December 15, 2013
* Regenerate commands for new 2.8.x Redis commands. (Marek Ventur) - Regenerate commands for new 2.8.x Redis commands. (Marek Ventur)
* Correctly time reconnect counts when using 'auth'. (William Hockey) - Correctly time reconnect counts when using 'auth'. (William Hockey)
## v0.9.1 - November 23, 2013 ## v0.9.1 - November 23, 2013
* Allow hmset to accept numeric keys. (Alex Stokes) - Allow hmset to accept numeric keys. (Alex Stokes)
* Fix TypeError for multiple MULTI/EXEC errors. (Kwangsu Kim) - Fix TypeError for multiple MULTI/EXEC errors. (Kwangsu Kim)
## v0.9.0 - October 17, 2013 ## v0.9.0 - October 17, 2013
* Domains support. (Forrest L Norvell) - Domains support. (Forrest L Norvell)
## v0.8.6 - October 2, 2013 ## v0.8.6 - October 2, 2013
* If error is already an Error, don't wrap it in another Error. (Mathieu M-Gosselin) - If error is already an Error, don't wrap it in another Error. (Mathieu M-Gosselin)
* Fix retry delay logic (Ian Babrou) - Fix retry delay logic (Ian Babrou)
* Return Errors instead of strings where Errors are expected (Ian Babrou) - Return Errors instead of strings where Errors are expected (Ian Babrou)
* Add experimental `.unref()` method to RedisClient (Bryce Baril / Olivier Lalonde) - Add experimental `.unref()` method to RedisClient (Bryce Baril / Olivier Lalonde)
* Strengthen checking of reply to prevent conflating "message" or "pmessage" fields with pub_sub replies. (Bryce Baril) - Strengthen checking of reply to prevent conflating "message" or "pmessage" fields with pub_sub replies. (Bryce Baril)
## v0.8.5 - September 26, 2013 ## v0.8.5 - September 26, 2013
* Add `auth_pass` option to connect and immediately authenticate (Henrik Peinar) - Add `auth_pass` option to connect and immediately authenticate (Henrik Peinar)
## v0.8.4 - June 24, 2013 ## v0.8.4 - June 24, 2013
Many contributed features and fixes, including: Many contributed features and fixes, including:
* Ignore password set if not needed. (jbergknoff)
* Improved compatibility with 0.10.X for tests and client.end() (Bryce Baril) - Ignore password set if not needed. (jbergknoff)
* Protect connection retries from application exceptions. (Amos Barreto) - Improved compatibility with 0.10.X for tests and client.end() (Bryce Baril)
* Better exception handling for Multi/Exec (Thanasis Polychronakis) - Protect connection retries from application exceptions. (Amos Barreto)
* Renamed pubsub mode to subscriber mode (Luke Plaster) - Better exception handling for Multi/Exec (Thanasis Polychronakis)
* Treat SREM like SADD when passed an array (Martin Ciparelli) - Renamed pubsub mode to subscriber mode (Luke Plaster)
* Fix empty unsub/punsub TypeError (Jeff Barczewski) - Treat SREM like SADD when passed an array (Martin Ciparelli)
* Only attempt to run a callback if it one was provided (jifeng) - Fix empty unsub/punsub TypeError (Jeff Barczewski)
- Only attempt to run a callback if it one was provided (jifeng)
## v0.8.3 - April 09, 2013 ## v0.8.3 - April 09, 2013
Many contributed features and fixes, including: Many contributed features and fixes, including:
* Fix some tests for Node.js version 0.9.x+ changes (Roman Ivanilov)
* Fix error when commands submitted after idle event handler (roamm)
* Bypass Redis for no-op SET/SETEX commands (jifeng)
* Fix HMGET + detect_buffers (Joffrey F)
* Fix CLIENT LOAD functionality (Jonas Dohse)
* Add percentage outputs to diff_multi_bench_output.js (Bryce Baril)
* Add retry_max_delay option (Tomasz Durka)
* Fix parser off-by-one errors with nested multi-bulk replies (Bryce Baril)
* Prevent parser from sinking application-side exceptions (Bryce Baril)
* Fix parser incorrect buffer skip when parsing multi-bulk errors (Bryce Baril)
* Reverted previous change with throwing on non-string values with HMSET (David Trejo)
* Fix command queue sync issue when using pubsub (Tom Leach)
* Fix compatibility with two-word Redis commands (Jonas Dohse)
* Add EVAL with array syntax (dmoena)
* Fix tests due to Redis reply order changes in 2.6.5+ (Bryce Baril)
* Added a test for the SLOWLOG command (Nitesh Sinha)
* Fix SMEMBERS order dependency in test broken by Redis changes (Garrett Johnson)
* Update commands for new Redis commands (David Trejo)
* Prevent exception from SELECT on subscriber reconnection (roamm)
- Fix some tests for Node.js version 0.9.x+ changes (Roman Ivanilov)
- Fix error when commands submitted after idle event handler (roamm)
- Bypass Redis for no-op SET/SETEX commands (jifeng)
- Fix HMGET + detect_buffers (Joffrey F)
- Fix CLIENT LOAD functionality (Jonas Dohse)
- Add percentage outputs to diff_multi_bench_output.js (Bryce Baril)
- Add retry_max_delay option (Tomasz Durka)
- Fix parser off-by-one errors with nested multi-bulk replies (Bryce Baril)
- Prevent parser from sinking application-side exceptions (Bryce Baril)
- Fix parser incorrect buffer skip when parsing multi-bulk errors (Bryce Baril)
- Reverted previous change with throwing on non-string values with HMSET (David Trejo)
- Fix command queue sync issue when using pubsub (Tom Leach)
- Fix compatibility with two-word Redis commands (Jonas Dohse)
- Add EVAL with array syntax (dmoena)
- Fix tests due to Redis reply order changes in 2.6.5+ (Bryce Baril)
- Added a test for the SLOWLOG command (Nitesh Sinha)
- Fix SMEMBERS order dependency in test broken by Redis changes (Garrett Johnson)
- Update commands for new Redis commands (David Trejo)
- Prevent exception from SELECT on subscriber reconnection (roamm)
## v0.8.2 - November 11, 2012 ## v0.8.2 - November 11, 2012
@@ -650,20 +655,20 @@ Important bug fix for null responses (Jerry Sievert)
Many contributed features and fixes, including: Many contributed features and fixes, including:
* Pure JavaScript reply parser that is usually faster than hiredis (Jerry Sievert) - Pure JavaScript reply parser that is usually faster than hiredis (Jerry Sievert)
* Remove hiredis as optionalDependency from package.json. It still works if you want it. - Remove hiredis as optionalDependency from package.json. It still works if you want it.
* Restore client state on reconnect, including select, subscribe, and monitor. (Ignacio Burgueño) - Restore client state on reconnect, including select, subscribe, and monitor. (Ignacio Burgueño)
* Fix idle event (Trae Robrock) - Fix idle event (Trae Robrock)
* Many documentation improvements and bug fixes (David Trejo) - Many documentation improvements and bug fixes (David Trejo)
## v0.7.2 - April 29, 2012 ## v0.7.2 - April 29, 2012
Many contributed fixes. Thank you, contributors. Many contributed fixes. Thank you, contributors.
* [GH-190] - pub/sub mode fix (Brian Noguchi) - [GH-190] - pub/sub mode fix (Brian Noguchi)
* [GH-165] - parser selection fix (TEHEK) - [GH-165] - parser selection fix (TEHEK)
* numerous documentation and examples updates - numerous documentation and examples updates
* auth errors emit Errors instead of Strings (David Trejo) - auth errors emit Errors instead of Strings (David Trejo)
## v0.7.1 - November 15, 2011 ## v0.7.1 - November 15, 2011
@@ -675,21 +680,21 @@ Very much need automated tests for reconnection and queue logic.
Many contributed fixes. Thanks everybody. Many contributed fixes. Thanks everybody.
* [GH-127] - properly re-initialize parser on reconnect - [GH-127] - properly re-initialize parser on reconnect
* [GH-136] - handle passing undefined as callback (Ian Babrou) - [GH-136] - handle passing undefined as callback (Ian Babrou)
* [GH-139] - properly handle exceptions thrown in pub/sub event handlers (Felix Geisendörfer) - [GH-139] - properly handle exceptions thrown in pub/sub event handlers (Felix Geisendörfer)
* [GH-141] - detect closing state on stream error (Felix Geisendörfer) - [GH-141] - detect closing state on stream error (Felix Geisendörfer)
* [GH-142] - re-select database on reconnection (Jean-Hugues Pinson) - [GH-142] - re-select database on reconnection (Jean-Hugues Pinson)
* [GH-146] - add sort example (Maksim Lin) - [GH-146] - add sort example (Maksim Lin)
Some more goodies: Some more goodies:
* Fix bugs with node 0.6 - Fix bugs with node 0.6
* Performance improvements - Performance improvements
* New version of `multi_bench.js` that tests more realistic scenarios - New version of `multi_bench.js` that tests more realistic scenarios
* [GH-140] - support optional callback for subscribe commands - [GH-140] - support optional callback for subscribe commands
* Properly flush and error out command queue when connection fails - Properly flush and error out command queue when connection fails
* Initial work on reconnection thresholds - Initial work on reconnection thresholds
## v0.6.7 - July 30, 2011 ## v0.6.7 - July 30, 2011
@@ -705,9 +710,9 @@ which did surprising things with Arrays.
Contributed changes: Contributed changes:
* Support SlowBuffers (Umair Siddique) - Support SlowBuffers (Umair Siddique)
* Add Multi to exports (Louis-Philippe Perron) - Add Multi to exports (Louis-Philippe Perron)
* Fix for drain event calculation (Vladimir Dronnikov) - Fix for drain event calculation (Vladimir Dronnikov)
Thanks! Thanks!
@@ -719,15 +724,15 @@ Fix bug with optional callbacks for hmset.
Bugs fixed: Bugs fixed:
* authentication retry while server is loading db (danmaz74) [GH-101] - authentication retry while server is loading db (danmaz74) [GH-101]
* command arguments processing issue with arrays - command arguments processing issue with arrays
New features: New features:
* Auto update of new commands from redis.io (Dave Hoover) - Auto update of new commands from redis.io (Dave Hoover)
* Performance improvements and backpressure controls. - Performance improvements and backpressure controls.
* Commands now return the true/false value from the underlying socket write(s). - Commands now return the true/false value from the underlying socket write(s).
* Implement command_queue high water and low water for more better control of queueing. - Implement command_queue high water and low water for more better control of queueing.
See `examples/backpressure_drain.js` for more information. See `examples/backpressure_drain.js` for more information.
@@ -743,12 +748,12 @@ Auto update of new commands from redis.io (Dave Hoover)
Lots of bugs fixed. Lots of bugs fixed.
* connection error did not properly trigger reconnection logic [GH-85] - connection error did not properly trigger reconnection logic [GH-85]
* client.hmget(key, [val1, val2]) was not expanding properly [GH-66] - client.hmget(key, [val1, val2]) was not expanding properly [GH-66]
* client.quit() while in pub/sub mode would throw an error [GH-87] - client.quit() while in pub/sub mode would throw an error [GH-87]
* client.multi(['hmset', 'key', {foo: 'bar'}]) fails [GH-92] - client.multi(['hmset', 'key', {foo: 'bar'}]) fails [GH-92]
* unsubscribe before subscribe would make things very confused [GH-88] - unsubscribe before subscribe would make things very confused [GH-88]
* Add BRPOPLPUSH [GH-79] - Add BRPOPLPUSH [GH-79]
## v0.5.11 - April 7, 2011 ## v0.5.11 - April 7, 2011
@@ -825,13 +830,13 @@ Fix bug where subscribe commands would not handle redis-server startup error pro
Some bug fixes: Some bug fixes:
* An important bug fix in reconnection logic. Previously, reply callbacks would be invoked twice after - An important bug fix in reconnection logic. Previously, reply callbacks would be invoked twice after
a reconnect. a reconnect.
* Changed error callback argument to be an actual Error object. - Changed error callback argument to be an actual Error object.
New feature: New feature:
* Add friendly syntax for HMSET using an object. - Add friendly syntax for HMSET using an object.
## v0.4.1 - December 8, 2010 ## v0.4.1 - December 8, 2010
@@ -865,9 +870,9 @@ Send a friendlier "error" event message on stream errors like connection refused
A few bug fixes. A few bug fixes.
* Fixed bug with `nil` multi-bulk reply lengths that showed up with `BLPOP` timeouts. - Fixed bug with `nil` multi-bulk reply lengths that showed up with `BLPOP` timeouts.
* Only emit `end` once when connection goes away. - Only emit `end` once when connection goes away.
* Fixed bug in `test.js` where driver finished before all tests completed. - Fixed bug in `test.js` where driver finished before all tests completed.
## unversioned wasteland ## unversioned wasteland

277
README.md
View File

@@ -19,115 +19,43 @@
--- ---
This is a complete and feature rich Redis client for Node.js. **It supports all ## Installation
Redis commands** and focuses on high performance.
Install with:
```bash ```bash
npm install redis npm install redis
``` ```
## Usage Example ## Usage
#### Example
```js ```js
const redis = require('redis'); const redis = require("redis");
const client = redis.createClient(); const client = redis.createClient();
// if you'd like to select database 3, instead of 0 (default), call client.on("error", function(err) {
// client.select(3, function() { /* ... */ }); console.log("Error " + err);
client.on('error', function(err) {
console.log('Error ' + err);
}); });
client.set('string key', 'string val', redis.print); client.set("string key", "string val", redis.print);
client.hset('hash key', 'hashtest 1', 'some value', redis.print); client.get("string key", redis.print);
client.hset(['hash key', 'hashtest 2', 'some other value'], redis.print);
client.hkeys('hash key', function(err, replies) {
console.log(replies.length + ' replies:');
replies.forEach(function(reply, i) {
console.log(' ' + i + ': ' + reply);
});
client.quit();
});
``` ```
This will display:
mjr:~/work/node_redis (master)$ node example.js
Reply: OK
Reply: 0
Reply: 0
2 replies:
0: hashtest 1
1: hashtest 2
mjr:~/work/node_redis (master)$
Note that the API is entirely asynchronous. To get data back from the server, Note that the API is entirely asynchronous. To get data back from the server,
you'll need to use a callback. From v.2.6 on the API supports camelCase and you'll need to use a callback.
snake_case and all options / variables / events etc. can be used either way. It
is recommended to use camelCase as this is the default for the Node.js
landscape.
### Promises ### Promises
#### Native Promises Node Redis currently doesn't natively support promises (this is coming in v4), however you can wrap the methods you
want to use with promises using the built-in Node.js `util.promisify` method on Node.js >= v8;
If you are using node v8 or higher, you can promisify node_redis with [util.promisify](https://nodejs.org/api/util.html#util_util_promisify_original) as in:
```js ```js
const { promisify } = require('util'); const { promisify } = require("util");
const getAsync = promisify(client.get).bind(client); const getAsync = promisify(client.get).bind(client);
```
now _getAsync_ is a promisified version of _client.get_: getAsync
.then(console.log)
```js .catch(console.error);
// We expect a value 'foo': 'bar' to be present
// So instead of writing client.get('foo', cb); you have to write:
return getAsync('foo').then(function(res) {
console.log(res); // => 'bar'
});
```
or using [async await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function):
```js
async function myFunc() {
const res = await getAsync('foo');
console.log(res);
}
```
#### Bluebird Promises
You can also use node_redis with promises by promisifying node_redis with
[bluebird](https://github.com/petkaantonov/bluebird) as in:
```js
const redis = require('redis');
bluebird.promisifyAll(redis);
```
It'll add a _Async_ to all node_redis functions (e.g. return client.getAsync().then())
```js
// We expect a value 'foo': 'bar' to be present
// So instead of writing client.get('foo', cb); you have to write:
return client.getAsync('foo').then(function(res) {
console.log(res); // => 'bar'
});
// Using multi with promises looks like:
return client
.multi()
.get('foo')
.execAsync()
.then(function(res) {
console.log(res); // => 'bar'
});
``` ```
### Sending Commands ### Sending Commands
@@ -138,16 +66,15 @@ a variable number of individual arguments followed by an optional callback.
Examples: Examples:
```js ```js
client.hmset(['key', 'test keys 1', 'test val 1', 'test keys 2', 'test val 2'], function( client.hmset(["key", "test keys 1", "test val 1", "test keys 2", "test val 2"], function(err, res) {
err, // ...
res, });
) {});
// Works the same as // Works the same as
client.hmset('key', ['test keys 1', 'test val 1', 'test keys 2', 'test val 2'], function(err, res) { client.hmset("key", ["test keys 1", "test val 1", "test keys 2", "test val 2"], function(err, res) {
// ... // ...
}); });
// Or // Or
client.hmset('key', 'test keys 1', 'test val 1', 'test keys 2', 'test val 2', function(err, res) { client.hmset("key", "test keys 1", "test val 1", "test keys 2", "test val 2", function(err, res) {
// ... // ...
}); });
``` ```
@@ -157,15 +84,15 @@ Care should be taken with user input if arrays are possible (via body-parser, qu
Note that in either form the `callback` is optional: Note that in either form the `callback` is optional:
```js ```js
client.set('some key', 'some val'); client.set("some key", "some val");
client.set(['some other key', 'some val']); client.set(["some other key", "some val"]);
``` ```
If the key is missing, reply will be null. Only if the [Redis Command If the key is missing, reply will be null. Only if the [Redis Command
Reference](http://redis.io/commands) states something else it will not be null. Reference](http://redis.io/commands) states something else it will not be null.
```js ```js
client.get('missingkey', function(err, reply) { client.get("missingkey", function(err, reply) {
// reply is null when the key is missing // reply is null when the key is missing
console.log(reply); console.log(reply);
}); });
@@ -189,7 +116,7 @@ Example setting key to auto expire using [SET command](https://redis.io/commands
```js ```js
// this key will expire after 10 seconds // this key will expire after 10 seconds
client.set('key', 'value!', 'EX', 10); client.set("key", "value!", "EX", 10);
``` ```
# API # API
@@ -275,18 +202,18 @@ using unix sockets if possible to increase throughput.
| retry_strategy | function | A function that receives an options object as parameter including the retry `attempt`, the `total_retry_time` indicating how much time passed since the last time connected, the `error` why the connection was lost and the number of `times_connected` in total. If you return a number from this function, the retry will happen exactly after that time in milliseconds. If you return a non-number, no further retry will happen and all offline commands are flushed with errors. Return an error to return that specific error to all offline commands. Example below. | | retry_strategy | function | A function that receives an options object as parameter including the retry `attempt`, the `total_retry_time` indicating how much time passed since the last time connected, the `error` why the connection was lost and the number of `times_connected` in total. If you return a number from this function, the retry will happen exactly after that time in milliseconds. If you return a non-number, no further retry will happen and all offline commands are flushed with errors. Return an error to return that specific error to all offline commands. Example below. |
```js ```js
var redis = require('redis'); var redis = require("redis");
var client = redis.createClient({ detect_buffers: true }); var client = redis.createClient({ detect_buffers: true });
client.set('foo_rand000000000000', 'OK'); client.set("foo_rand000000000000", "OK");
// This will return a JavaScript String // This will return a JavaScript String
client.get('foo_rand000000000000', function(err, reply) { client.get("foo_rand000000000000", function(err, reply) {
console.log(reply.toString()); // Will print `OK` console.log(reply.toString()); // Will print `OK`
}); });
// This will return a Buffer since original key is specified as a Buffer // This will return a Buffer since original key is specified as a Buffer
client.get(new Buffer('foo_rand000000000000'), function(err, reply) { client.get(new Buffer("foo_rand000000000000"), function(err, reply) {
console.log(reply.toString()); // Will print `<Buffer 4f 4b>` console.log(reply.toString()); // Will print `<Buffer 4f 4b>`
}); });
client.quit(); client.quit();
@@ -297,15 +224,15 @@ client.quit();
```js ```js
var client = redis.createClient({ var client = redis.createClient({
retry_strategy: function(options) { retry_strategy: function(options) {
if (options.error && options.error.code === 'ECONNREFUSED') { if (options.error && options.error.code === "ECONNREFUSED") {
// End reconnecting on a specific error and flush all commands with // End reconnecting on a specific error and flush all commands with
// a individual error // a individual error
return new Error('The server refused the connection'); return new Error("The server refused the connection");
} }
if (options.total_retry_time > 1000 * 60 * 60) { if (options.total_retry_time > 1000 * 60 * 60) {
// End reconnecting after a specific timeout and flush all commands // End reconnecting after a specific timeout and flush all commands
// with a individual error // with a individual error
return new Error('Retry time exhausted'); return new Error("Retry time exhausted");
} }
if (options.attempt > 10) { if (options.attempt > 10) {
// End reconnecting with built in error // End reconnecting with built in error
@@ -363,23 +290,23 @@ This example closes the connection to the Redis server before the replies have
been read. You probably don't want to do this: been read. You probably don't want to do this:
```js ```js
var redis = require('redis'), var redis = require("redis"),
client = redis.createClient(); client = redis.createClient();
client.set('foo_rand000000000000', 'some fantastic value', function(err, reply) { client.set("foo_rand000000000000", "some fantastic value", function(err, reply) {
// This will either result in an error (flush parameter is set to true) // This will either result in an error (flush parameter is set to true)
// or will silently fail and this callback will not be called at all (flush set to false) // or will silently fail and this callback will not be called at all (flush set to false)
console.log(err); console.log(err);
}); });
client.end(true); // No further commands will be processed client.end(true); // No further commands will be processed
client.get('foo_rand000000000000', function(err, reply) { client.get("foo_rand000000000000", function(err, reply) {
console.log(err); // => 'The connection has already been closed.' console.log(err); // => 'The connection has already been closed.'
}); });
``` ```
`client.end()` without the flush parameter set to true should NOT be used in production! `client.end()` without the flush parameter set to true should NOT be used in production!
## Error handling (>= v.2.6) ## Error handling (>= v2.6)
Currently the following error subclasses exist: Currently the following error subclasses exist:
@@ -398,27 +325,27 @@ All error classes are exported by the module.
Example: Example:
```js ```js
var redis = require('./'); var redis = require("./");
var assert = require('assert'); var assert = require("assert");
var client = redis.createClient(); var client = redis.createClient();
client.on('error', function(err) { client.on("error", function(err) {
assert(err instanceof Error); assert(err instanceof Error);
assert(err instanceof redis.AbortError); assert(err instanceof redis.AbortError);
assert(err instanceof redis.AggregateError); assert(err instanceof redis.AggregateError);
// The set and get get aggregated in here // The set and get get aggregated in here
assert.strictEqual(err.errors.length, 2); assert.strictEqual(err.errors.length, 2);
assert.strictEqual(err.code, 'NR_CLOSED'); assert.strictEqual(err.code, "NR_CLOSED");
}); });
client.set('foo', 123, 'bar', function(err, res) { client.set("foo", 123, "bar", function(err, res) {
// Too many arguments // Too many arguments
assert(err instanceof redis.ReplyError); // => true assert(err instanceof redis.ReplyError); // => true
assert.strictEqual(err.command, 'SET'); assert.strictEqual(err.command, "SET");
assert.deepStrictEqual(err.args, ['foo', 123, 'bar']); assert.deepStrictEqual(err.args, ["foo", 123, "bar"]);
redis.debug_mode = true; redis.debug_mode = true;
client.set('foo', 'bar'); client.set("foo", "bar");
client.get('foo'); client.get("foo");
process.nextTick(function() { process.nextTick(function() {
// Force closing the connection while the command did not yet return // Force closing the connection while the command did not yet return
client.end(true); client.end(true);
@@ -449,7 +376,7 @@ protocol. Any commands where client state is saved on the Redis server, e.g.
`*SUBSCRIBE` or the blocking `BL*` commands will _NOT_ work with `.unref()`. `*SUBSCRIBE` or the blocking `BL*` commands will _NOT_ work with `.unref()`.
```js ```js
var redis = require('redis'); var redis = require("redis");
var client = redis.createClient(); var client = redis.createClient();
/* /*
@@ -458,7 +385,7 @@ var client = redis.createClient();
client-server connection is alive. client-server connection is alive.
*/ */
client.unref(); client.unref();
client.get('foo', function(err, value) { client.get("foo", function(err, value) {
if (err) throw err; if (err) throw err;
console.log(value); console.log(value);
}); });
@@ -479,8 +406,8 @@ syntax.
Example: Example:
```js ```js
client.hmset('hosts', 'mjr', '1', 'another', '23', 'home', '1234'); client.hmset("hosts", "mjr", "1", "another", "23", "home", "1234");
client.hgetall('hosts', function(err, obj) { client.hgetall("hosts", function(err, obj) {
console.dir(obj); console.dir(obj);
}); });
``` ```
@@ -491,8 +418,8 @@ Multiple values in a hash can be set by supplying an object:
```js ```js
client.HMSET(key2, { client.HMSET(key2, {
'0123456789': 'abcdefghij', // NOTE: key and value will be coerced to strings "0123456789": "abcdefghij", // NOTE: key and value will be coerced to strings
'some manner of key': 'a type of value', "some manner of key": "a type of value",
}); });
``` ```
@@ -504,7 +431,7 @@ Redis hash.
Multiple values may also be set by supplying a list: Multiple values may also be set by supplying a list:
```js ```js
client.HMSET(key1, '0123456789', 'abcdefghij', 'some manner of key', 'a type of value'); client.HMSET(key1, "0123456789", "abcdefghij", "some manner of key", "a type of value");
``` ```
## Publish / Subscribe ## Publish / Subscribe
@@ -514,19 +441,19 @@ client connections, subscribes to a channel on one of them, and publishes to tha
channel on the other: channel on the other:
```js ```js
var redis = require('redis'); var redis = require("redis");
var sub = redis.createClient(), var sub = redis.createClient(),
pub = redis.createClient(); pub = redis.createClient();
var msg_count = 0; var msg_count = 0;
sub.on('subscribe', function(channel, count) { sub.on("subscribe", function(channel, count) {
pub.publish('a nice channel', 'I am sending a message.'); pub.publish("a nice channel", "I am sending a message.");
pub.publish('a nice channel', 'I am sending a second message.'); pub.publish("a nice channel", "I am sending a second message.");
pub.publish('a nice channel', 'I am sending my last message.'); pub.publish("a nice channel", "I am sending my last message.");
}); });
sub.on('message', function(channel, message) { sub.on("message", function(channel, message) {
console.log('sub channel ' + channel + ': ' + message); console.log("sub channel " + channel + ": " + message);
msg_count += 1; msg_count += 1;
if (msg_count === 3) { if (msg_count === 3) {
sub.unsubscribe(); sub.unsubscribe();
@@ -535,7 +462,7 @@ sub.on('message', function(channel, message) {
} }
}); });
sub.subscribe('a nice channel'); sub.subscribe("a nice channel");
``` ```
When a client issues a `SUBSCRIBE` or `PSUBSCRIBE`, that connection is put into When a client issues a `SUBSCRIBE` or `PSUBSCRIBE`, that connection is put into
@@ -610,33 +537,33 @@ further information look at
[transactions](http://redis.io/topics/transactions)). [transactions](http://redis.io/topics/transactions)).
```js ```js
var redis = require('./index'), var redis = require("./index"),
client = redis.createClient(), client = redis.createClient(),
set_size = 20; set_size = 20;
client.sadd('bigset', 'a member'); client.sadd("bigset", "a member");
client.sadd('bigset', 'another member'); client.sadd("bigset", "another member");
while (set_size > 0) { while (set_size > 0) {
client.sadd('bigset', 'member ' + set_size); client.sadd("bigset", "member " + set_size);
set_size -= 1; set_size -= 1;
} }
// multi chain with an individual callback // multi chain with an individual callback
client client
.multi() .multi()
.scard('bigset') .scard("bigset")
.smembers('bigset') .smembers("bigset")
.keys('*', function(err, replies) { .keys("*", function(err, replies) {
// NOTE: code in this callback is NOT atomic // NOTE: code in this callback is NOT atomic
// this only happens after the the .exec call finishes. // this only happens after the the .exec call finishes.
client.mget(replies, redis.print); client.mget(replies, redis.print);
}) })
.dbsize() .dbsize()
.exec(function(err, replies) { .exec(function(err, replies) {
console.log('MULTI got ' + replies.length + ' replies'); console.log("MULTI got " + replies.length + " replies");
replies.forEach(function(reply, index) { replies.forEach(function(reply, index) {
console.log('Reply ' + index + ': ' + reply.toString()); console.log("Reply " + index + ": " + reply.toString());
}); });
}); });
``` ```
@@ -659,17 +586,17 @@ can queue individual commands while still sending regular client command as in
this example: this example:
```js ```js
var redis = require('redis'), var redis = require("redis"),
client = redis.createClient(), client = redis.createClient(),
multi; multi;
// start a separate multi command queue // start a separate multi command queue
multi = client.multi(); multi = client.multi();
multi.incr('incr thing', redis.print); multi.incr("incr thing", redis.print);
multi.incr('incr other thing', redis.print); multi.incr("incr other thing", redis.print);
// runs immediately // runs immediately
client.mset('incr thing', 100, 'incr other thing', 1, redis.print); client.mset("incr thing", 100, "incr other thing", 1, redis.print);
// drains multi queue and runs atomically // drains multi queue and runs atomically
multi.exec(function(err, replies) { multi.exec(function(err, replies) {
@@ -681,14 +608,14 @@ In addition to adding commands to the `MULTI` queue individually, you can also
pass an array of commands and arguments to the constructor: pass an array of commands and arguments to the constructor:
```js ```js
var redis = require('redis'), var redis = require("redis"),
client = redis.createClient(); client = redis.createClient();
client client
.multi([ .multi([
['mget', 'multifoo', 'multibar', redis.print], ["mget", "multifoo", "multibar", redis.print],
['incr', 'multifoo'], ["incr", "multifoo"],
['incr', 'multibar'], ["incr", "multibar"],
]) ])
.exec(function(err, replies) { .exec(function(err, replies) {
console.log(replies); console.log(replies);
@@ -853,14 +780,14 @@ arguments and the raw monitoring string.
Example: Example:
```js ```js
var client = require('redis').createClient(); var client = require("redis").createClient();
client.monitor(function(err, res) { client.monitor(function(err, res) {
console.log('Entering monitoring mode.'); console.log("Entering monitoring mode.");
}); });
client.set('foo', 'bar'); client.set("foo", "bar");
client.on('monitor', function(time, args, raw_reply) { client.on("monitor", function(time, args, raw_reply) {
console.log(time + ': ' + args); // 1458910076.446514:['set', 'foo', 'bar'] console.log(time + ": " + args); // 1458910076.446514:['set', 'foo', 'bar']
}); });
``` ```
@@ -886,12 +813,12 @@ easy comparison.
A handy callback function for displaying return values when testing. Example: A handy callback function for displaying return values when testing. Example:
```js ```js
var redis = require('redis'), var redis = require("redis"),
client = redis.createClient(); client = redis.createClient();
client.on('connect', function() { client.on("connect", function() {
client.set('foo_rand000000000000', 'some fantastic value', redis.print); client.set("foo_rand000000000000", "some fantastic value", redis.print);
client.get('foo_rand000000000000', redis.print); client.get("foo_rand000000000000", redis.print);
}); });
``` ```
@@ -908,12 +835,12 @@ To execute redis multi-word commands like `SCRIPT LOAD` or `CLIENT LIST` pass
the second word as first parameter: the second word as first parameter:
```js ```js
client.script('load', 'return 1'); client.script("load", "return 1");
client client
.multi() .multi()
.script('load', 'return 1') .script("load", "return 1")
.exec(); .exec();
client.multi([['script', 'load', 'return 1']]).exec(); client.multi([["script", "load", "return 1"]]).exec();
``` ```
## client.duplicate([options][, callback]) ## client.duplicate([options][, callback])
@@ -930,21 +857,21 @@ are used on the same redisClient instance as non-blocking commands, the
non-blocking ones may be queued up until after the blocking ones finish. non-blocking ones may be queued up until after the blocking ones finish.
```js ```js
var Redis = require('redis'); var Redis = require("redis");
var client = Redis.createClient(); var client = Redis.createClient();
var clientBlocking = client.duplicate(); var clientBlocking = client.duplicate();
var get = function() { var get = function() {
console.log('get called'); console.log("get called");
client.get('any_key', function() { client.get("any_key", function() {
console.log('get returned'); console.log("get returned");
}); });
setTimeout(get, 1000); setTimeout(get, 1000);
}; };
var brpop = function() { var brpop = function() {
console.log('brpop called'); console.log("brpop called");
clientBlocking.brpop('nonexistent', 5, function() { clientBlocking.brpop("nonexistent", 5, function() {
console.log('brpop return'); console.log("brpop return");
setTimeout(brpop, 1000); setTimeout(brpop, 1000);
}); });
}; };
@@ -994,16 +921,16 @@ This applies to anything that uses an optional `[WITHSCORES]` or `[LIMIT offset
Example: Example:
```js ```js
var args = ['myzset', 1, 'one', 2, 'two', 3, 'three', 99, 'ninety-nine']; var args = ["myzset", 1, "one", 2, "two", 3, "three", 99, "ninety-nine"];
client.zadd(args, function(err, response) { client.zadd(args, function(err, response) {
if (err) throw err; if (err) throw err;
console.log('added ' + response + ' items.'); console.log("added " + response + " items.");
// -Infinity and +Infinity also work // -Infinity and +Infinity also work
var args1 = ['myzset', '+inf', '-inf']; var args1 = ["myzset", "+inf", "-inf"];
client.zrevrangebyscore(args1, function(err, response) { client.zrevrangebyscore(args1, function(err, response) {
if (err) throw err; if (err) throw err;
console.log('example1', response); console.log("example1", response);
// write your code here // write your code here
}); });
@@ -1011,10 +938,10 @@ client.zadd(args, function(err, response) {
min = 1, min = 1,
offset = 1, offset = 1,
count = 2; count = 2;
var args2 = ['myzset', max, min, 'WITHSCORES', 'LIMIT', offset, count]; var args2 = ["myzset", max, min, "WITHSCORES", "LIMIT", offset, count];
client.zrevrangebyscore(args2, function(err, response) { client.zrevrangebyscore(args2, function(err, response) {
if (err) throw err; if (err) throw err;
console.log('example2', response); console.log("example2", response);
// write your code here // write your code here
}); });
}); });