You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-10 11:43:01 +03:00
readme.md: how to ZREVRANGEBYSCORE with LIMIT. fixes #163
This commit is contained in:
28
README.md
28
README.md
@@ -119,6 +119,34 @@ Minimal parsing is done on the replies. Commands that return a single line repl
|
|||||||
integer replies return JavaScript Numbers, "bulk" replies return node Buffers, and "multi bulk" replies return a
|
integer replies return JavaScript Numbers, "bulk" replies return node Buffers, and "multi bulk" replies return a
|
||||||
JavaScript Array of node Buffers. `HGETALL` returns an Object with Buffers keyed by the hash keys.
|
JavaScript Array of node Buffers. `HGETALL` returns an Object with Buffers keyed by the hash keys.
|
||||||
|
|
||||||
|
### Commands with Optional and Keyword arguments
|
||||||
|
|
||||||
|
This applies to anything that uses an optional `[WITHSCORES]` or `[LIMIT offset count]` in the [redis.io/commands](http://redis.io/commands) documentation.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```js
|
||||||
|
var args = [ 'myzset', 1, 'one', 2, 'two', 3, 'three', 99, 'ninety-nine' ];
|
||||||
|
client.zadd(args, function (err, response) {
|
||||||
|
if (err) throw err;
|
||||||
|
console.log('added '+response+' items.');
|
||||||
|
|
||||||
|
// -Infinity and +Infinity also work
|
||||||
|
var args1 = [ 'myzset', '+inf', '-inf' ];
|
||||||
|
client.zrevrangebyscore(args1, function (err, response) {
|
||||||
|
if (err) throw err;
|
||||||
|
console.log('example1', response);
|
||||||
|
// write your code here
|
||||||
|
});
|
||||||
|
|
||||||
|
var max = 3, min = 1, offset = 1, count = 2;
|
||||||
|
var args2 = [ 'myzset', max, min, 'WITHSCORES', 'LIMIT', offset, count ];
|
||||||
|
client.zrevrangebyscore(args2, function (err, response) {
|
||||||
|
if (err) throw err;
|
||||||
|
console.log('example2', response);
|
||||||
|
// write your code here
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
# API
|
# API
|
||||||
|
|
||||||
## Connection Events
|
## Connection Events
|
||||||
|
Reference in New Issue
Block a user