From 1820190f96ade99135b7c9e19c7487a1c5c09f66 Mon Sep 17 00:00:00 2001 From: siddontang Date: Thu, 2 Oct 2014 15:40:53 +0800 Subject: [PATCH] update doc --- doc/commands.json | 18 ++++++++++++ doc/commands.md | 70 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/doc/commands.json b/doc/commands.json index 6ed95bd..b813d3b 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -512,6 +512,24 @@ "readonly": false }, + "ZRANGEBYLEX":{ + "arguments": "key min max [LIMIT offset count]", + "group": "ZSet", + "readonly": true + }, + + "ZREMRANGBYLEX":{ + "arguments": "key min max", + "group": "ZSet", + "readonly": false + }, + + "ZLEXCOUNT":{ + "arguments": "key min max", + "group": "ZSet", + "readonly": true + }, + "BEGIN": { "arguments": "-", "group": "Transaction", diff --git a/doc/commands.md b/doc/commands.md index 4f90a18..2cae8fd 100644 --- a/doc/commands.md +++ b/doc/commands.md @@ -106,6 +106,9 @@ Table of Contents - [ZINTERSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX] ](#zinterstore-destination-numkeys-key-key--weights-weight-weight--aggregate-summinmax) - [ZXSCAN key [MATCH match] [COUNT count]](#zxscan-key-match-match-count-count) + - [ZRANGEBYLEX key min max [LIMIT offset count]](#zrangebylex-key-min-max-limit-offset-count) + - [ZREMRANGEBYLEX key min max](#zremrangebylex-key-min-max) + - [ZLEXCOUNT key min max](#zlexcount-key-min-max) - [Bitmap](#bitmap) - [BGET key](#bget-key) - [BGETBIT key offset](#bgetbit-key-offset) @@ -2227,10 +2230,75 @@ Iterate ZSet keys incrementally. See [XSCAN](#xscan-key-match-match-count-count) for more information. +### ZRANGEBYLEX key min max [LIMIT offset count] + +When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns all the elements in the sorted set at key with a value between min and max. + +If the elements in the sorted set have different scores, the returned elements are unspecified. + +Valid start and stop must start with ( or [, in order to specify if the range item is respectively exclusive or inclusive. The special values of + or - for start and stop have the special meaning or positively infinite and negatively infinite strings, so for instance the command ZRANGEBYLEX myzset - + is guaranteed to return all the elements in the sorted set, if all the elements have the same score. + +**Return value** + +array: list of elements in the specified score range + +**Example** + +``` +ledis> ZADD myzset 0 a 0 b 0 c 0 d 0 e 0 f 0 g +(integer) 7 +ledis> ZRANGEBYLEX myzset - [c +1) "a" +2) "b" +3) "c" +ledis> ZRANGEBYLEX myzset - (c +1) "a" +2) "b" +ledis> ZRANGEBYLEX myzset [aaa (g +1) "b" +2) "c" +3) "d" +4) "e" +5) "f" +``` + +### ZREMRANGEBYLEX key min max + +Removes all elements in the sorted set stored at key between the lexicographical range specified by min and max. + +**Return value** + +int64: he number of elements removed. + +**Example** + +``` +ledis> ZADD myzset 0 a 0 b 0 c 0 d 0 e 0 f 0 g +(integer) 7 +ledis> ZREMRANGEBYLEX myzset - [c +(integer) 3 +``` + +### ZLEXCOUNT key min max + +Returns the number of elements in the sorted set at key with a value between min and max. + +**Return value** + +int64: the number of elements in the specified score range. + +**Example** + +``` +ledis> ZADD myzset 0 a 0 b 0 c 0 d 0 e 0 f 0 g +(integer) 7 +ledis> ZLEXCOUNT myzset - [c +(integer) 3 +``` + ## Bitmap - ### BGET key Returns the whole binary data stored at `key`.