diff --git a/cmd/ledis-cli/const.go b/cmd/ledis-cli/const.go index a3e0674..9fc72dd 100644 --- a/cmd/ledis-cli/const.go +++ b/cmd/ledis-cli/const.go @@ -1,4 +1,4 @@ -//This file was generated by .tools/generate_commands.py on Fri Feb 06 2015 09:15:18 +0800 +//This file was generated by .tools/generate_commands.py on Mon Mar 02 2015 14:43:25 +0800 package main var helpCommands = [][]string{ @@ -20,8 +20,6 @@ var helpCommands = [][]string{ {"BRPOP", "key [key ...] timeout", "List"}, {"BSETBIT", "key offset value", "Bitmap"}, {"BTTL", "key", "Bitmap"}, - {"BXREVSCAN", "key [MATCH match] [COUNT count]", "Bitmap"}, - {"BXSCAN", "key [MATCH match] [COUNT count]", "Bitmap"}, {"COMMIT", "-", "Transaction"}, {"CONFIG REWRITE", "-", "Server"}, {"DECR", "key", "KV"}, @@ -59,8 +57,6 @@ var helpCommands = [][]string{ {"HSET", "key field value", "Hash"}, {"HTTL", "key", "Hash"}, {"HVALS", "key", "Hash"}, - {"HXREVSCAN", "key [MATCH match] [COUNT count]", "Hash"}, - {"HXSCAN", "key [MATCH match] [COUNT count]", "Hash"}, {"INCR", "key", "KV"}, {"INCRBY", "key increment", "KV"}, {"INFO", "[section]", "Server"}, @@ -76,8 +72,6 @@ var helpCommands = [][]string{ {"LPUSH", "key value [value ...]", "List"}, {"LRANGE", "key start stop", "List"}, {"LTTL", "key", "List"}, - {"LXREVSCAN", "key [MATCH match] [COUNT count]", "List"}, - {"LXSCAN", "key [MATCH match] [COUNT count]", "List"}, {"MGET", "key [key ...]", "KV"}, {"MSET", "key value [key value ...]", "KV"}, {"PERSIST", "key", "KV"}, @@ -116,23 +110,13 @@ var helpCommands = [][]string{ {"STTL", "key", "Set"}, {"SUNION", "key [key ...]", "Set"}, {"SUNIONSTORE", "destination key [key ...]", "Set"}, - {"SXREVSCAN", "key [MATCH match] [COUNT count]", "Set"}, - {"SXSCAN", "key [MATCH match] [COUNT count]", "Set"}, {"SYNC", "logid", "Replication"}, {"TIME", "-", "Server"}, {"TTL", "key", "KV"}, - {"XBREVSCAN", "key [MATCH match] [COUNT count]", "Bitmap"}, - {"XBSCAN", "key [MATCH match] [COUNT count]", "Bitmap"}, - {"XHREVSCAN", "key [MATCH match] [COUNT count]", "Hash"}, - {"XHSCAN", "key [MATCH match] [COUNT count]", "Hash"}, - {"XLREVSCAN", "key [MATCH match] [COUNT count]", "List"}, - {"XLSCAN", "key [MATCH match] [COUNT count]", "List"}, - {"XREVSCAN", "key [MATCH match] [COUNT count]", "KV"}, - {"XSCAN", "key [MATCH match] [COUNT count]", "KV"}, - {"XSREVSCAN", "key [MATCH match] [COUNT count]", "Set"}, - {"XSSCAN", "key [MATCH match] [COUNT count]", "Set"}, - {"XZREVSCAN", "key [MATCH match] [COUNT count]", "ZSet"}, - {"XZSCAN", "key [MATCH match] [COUNT count]", "ZSet"}, + {"XHSCAN", "key cursor [MATCH match] [COUNT count]", "Hash"}, + {"XSCAN", "type cursor [MATCH match] [COUNT count]", "Server"}, + {"XSSCAN", "key cursor [MATCH match] [COUNT count]", "Set"}, + {"XZSCAN", "key cursor [MATCH match] [COUNT count]", "ZSet"}, {"ZADD", "key score member [score member ...]", "ZSet"}, {"ZCARD", "key", "ZSet"}, {"ZCLEAR", "key", "ZSet"}, @@ -159,6 +143,4 @@ var helpCommands = [][]string{ {"ZSCORE", "key member", "ZSet"}, {"ZTTL", "key", "ZSet"}, {"ZUNIONSTORE", "destkey numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX]", "ZSet"}, - {"ZXREVSCAN", "key [MATCH match] [COUNT count]", "ZSet"}, - {"ZXSCAN", "key [MATCH match] [COUNT count]", "ZSet"}, } diff --git a/doc/commands.json b/doc/commands.json index 4b549db..281fd07 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -560,79 +560,7 @@ "group": "Transaction", "readonly": false }, - - "XSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "KV", - "readonly": true - }, - - "HXSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "Hash", - "readonly": true - }, - - "LXSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "List", - "readonly": true - }, - - "SXSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "Set", - "readonly": true - }, - - "ZXSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "ZSet", - "readonly": true - }, - - "BXSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "Bitmap", - "readonly": true - }, - - "XREVSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "KV", - "readonly": true - }, - - "HXREVSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "Hash", - "readonly": true - }, - - "LXREVSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "List", - "readonly": true - }, - - "SXREVSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "Set", - "readonly": true - }, - - "ZXREVSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "ZSet", - "readonly": true - }, - - "BXREVSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "Bitmap", - "readonly": true - }, - + "FLUSHALL": { "arguments": "-", "group": "Server", @@ -724,66 +652,30 @@ "readonly": true }, - "XBSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "Bitmap", - "readonly": true - }, - - "XLSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "List", + "XSCAN": { + "arguments": "type cursor [MATCH match] [COUNT count]", + "group": "Server", "readonly": true }, "XHSCAN": { - "arguments": "key [MATCH match] [COUNT count]", + "arguments": "key cursor [MATCH match] [COUNT count]", "group": "Hash", "readonly": true }, "XSSCAN": { - "arguments": "key [MATCH match] [COUNT count]", + "arguments": "key cursor [MATCH match] [COUNT count]", "group": "Set", "readonly": true }, "XZSCAN": { - "arguments": "key [MATCH match] [COUNT count]", + "arguments": "key cursor [MATCH match] [COUNT count]", "group": "ZSet", "readonly": true }, - "XHREVSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "Hash", - "readonly": true - }, - - "XLREVSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "List", - "readonly": true - }, - - "XSREVSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "Set", - "readonly": true - }, - - "XZREVSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "ZSet", - "readonly": true - }, - - "XBREVSCAN": { - "arguments": "key [MATCH match] [COUNT count]", - "group": "Bitmap", - "readonly": true - }, - "RESTORE": { "arguments" : "key ttl value", "group" : "Server", diff --git a/doc/commands.md b/doc/commands.md index 1cde082..2e4bce6 100644 --- a/doc/commands.md +++ b/doc/commands.md @@ -27,8 +27,6 @@ Table of Contents - [EXPIREAT key timestamp](#expireat-key-timestamp) - [TTL key](#ttl-key) - [PERSIST key](#persist-key) - - [XSCAN key [MATCH match] [COUNT count]](#xscan-key-match-match-count-count) - - [XREVSCAN key [MATCH match] [COUNT count]](#xrevscan-key-match-match-count-count) - [DUMP key](#dump-key) - [Hash](#hash) - [HDEL key field [field ...]](#hdel-key-field-field-) @@ -48,10 +46,6 @@ Table of Contents - [HEXPIREAT key timestamp](#hexpireat-key-timestamp) - [HTTL key](#httl-key) - [HPERSIST key](#hpersist-key) - - [HXSCAN key [MATCH match] [COUNT count]](#hxscan-key-match-match-count-count) - - [HXREVSCAN key [MATCH match] [COUNT count]](#hxrevscan-key-match-match-count-count) - - [XHSCAN key [MATCH match] [COUNT count]](#xhscan-key-match-match-count-count) - - [XHREVSCAN key [MATCH match] [COUNT count]](#xhrevscan-key-match-match-count-count) - [HDUMP key](#hdump-key) - [List](#list) - [BLPOP key [key ...] timeout](#blpop-key-key--timeout) @@ -69,10 +63,6 @@ Table of Contents - [LEXPIREAT key timestamp](#lexpireat-key-timestamp) - [LTTL key](#lttl-key) - [LPERSIST key](#lpersist-key) - - [LXSCAN key [MATCH match] [COUNT count]](#lxscan-key-match-match-count-count) - - [LXREVSCAN key [MATCH match] [COUNT count]](#lxrevscan-key-match-match-count-count) - - [XLSCAN key [MATCH match] [COUNT count]](#xlscan-key-match-match-count-count) - - [XLREVSCAN key [MATCH match] [COUNT count]](#xlrevscan-key-match-match-count-count) - [LDUMP key](#ldump-key) - [Set](#set) - [SADD key member [member ...]](#sadd-key-member-member-) @@ -92,10 +82,6 @@ Table of Contents - [SEXPIREAT key timestamp](#sexpireat-key-timestamp) - [STTL key](#sttl-key) - [SPERSIST key](#spersist-key) - - [SXSCAN key [MATCH match] [COUNT count]](#sxscan-key-match-match-count-count) - - [SXREVSCAN key [MATCH match] [COUNT count]](#sxrevscan-key-match-match-count-count) - - [XSSCAN key [MATCH match] [COUNT count]](#xsscan-key-match-match-count-count) - - [XSREVSCAN key [MATCH match] [COUNT count]](#xsrevscan-key-match-match-count-count) - [SDUMP key](#sdump-key) - [ZSet](#zset) - [ZADD key score member [score member ...]](#zadd-key-score-member-score-member-) @@ -122,10 +108,6 @@ Table of Contents ](#zunionstore-destination-numkeys-key-key--weights-weight-weight--aggregate-summinmax) - [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) - - [ZXREVSCAN key [MATCH match] [COUNT count]](#zxrevscan-key-match-match-count-count) - - [XZSCAN key [MATCH match] [COUNT count]](#xzscan-key-match-match-count-count) - - [XZREVSCAN key [MATCH match] [COUNT count]](#xzrevscan-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) @@ -141,10 +123,11 @@ Table of Contents - [BEXPIREAT key timestamp](#bexpireat-key-timestamp) - [BTTL key](#bttl-key) - [BPERSIST key](#bpersist-key) - - [BXSCAN key [MATCH match] [COUNT count]](#bxscan-key-match-match-count-count) - - [BXREVSCAN key [MATCH match] [COUNT count]](#bxrevscan-key-match-match-count-count) - - [XBSCAN key [MATCH match] [COUNT count]](#xbscan-key-match-match-count-count) - - [XBREVSCAN key [MATCH match] [COUNT count]](#xbrevscan-key-match-match-count-count) +- [Scan](#scan) + - [XSCAN type cursor [MATCH match] [COUNT count]](#xscan-type-cursor-match-match-count-count) + - [XHSCAN key cursor [MATCH match] [COUNT count]](#xhscan-key-cursor-match-match-count-count) + - [XSSCAN key cursor [MATCH match] [COUNT count]](#xsscan-key-cursor-match-match-count-count) + - [XZSCAN key cursor [MATCH match] [COUNT count]](#xzscan-key-cursor-match-match-count-count) - [Replication](#replication) - [SLAVEOF host port [RESTART] [READONLY]](#slaveof-host-port-restart-readonly) - [FULLSYNC [NEW]](#fullsync-new) @@ -524,82 +507,6 @@ ledis> TTL mykey (integer) -1 ``` -### XSCAN key [MATCH match] [COUNT count] - -Iterate KV keys incrementally. - -Key is the start for the current iteration. -Match is the regexp for checking matched key. -Count is the maximum retrieved elememts number, default is 10. - -**Return value** - -an array of two values, first value is the key for next iteration, second value is an array of elements. - -**Examples** - -``` -ledis>set a 1 -OK -ledis>set b 2 -OK -ledis>set c 3 -OK -127.0.0.1:6380>xscan "" -1) "" -2) ["a" "b" "c"] -ledis>xscan "" count 1 -1) "a" -2) ["a"] -ledis>xscan "a" count 1 -1) "b" -2) ["b"] -ledis>xscan "b" count 1 -1) "c" -2) ["c"] -ledis>xscan "c" count 1 -1) "" -2) [] -``` - -### XREVSCAN key [MATCH match] [COUNT count] - -Reverse iterate KV keys incrementally. - -Key is the start for the current iteration. -Match is the regexp for checking matched key. -Count is the maximum retrieved elememts number, default is 10. - -**Return value** - -an array of two values, first value is the key for next iteration, second value is an array of elements. - -**Examples** - -``` -ledis>set a 1 -OK -ledis>set b 2 -OK -ledis>set c 3 -OK -127.0.0.1:6380>xrevscan "" -1) "" -2) ["c" "b" "a"] -ledis>xrevscan "" count 1 -1) "c" -2) ["c"] -ledis>xrevscan "c" count 1 -1) "b" -2) ["b"] -ledis>xrevscan "b" count 1 -1) "a" -2) ["a"] -ledis>xrevscan "a" count 1 -1) "" -2) [] -``` - ### DUMP key Serialize the value stored at key with KV type in a Redis-specific format like RDB and return it to the user. The returned value can be synthesized back into a key using the RESTORE command. @@ -980,31 +887,6 @@ ledis> HPERSIST not_exists_key (integer) 0 ``` -### HXSCAN key [MATCH match] [COUNT count] - -Iterate Hash keys incrementally. - -See [XSCAN](#xscan-key-match-match-count-count) for more information. - -### HXREVSCAN key [MATCH match] [COUNT count] - -Reverse iterate Hash keys incrementally. - -See [XREVSCAN](#xrevscan-key-match-match-count-count) for more information. - -### XHSCAN key [MATCH match] [COUNT count] - -Iterate Hash keys incrementally. - -See [XSCAN](#xscan-key-match-match-count-count) for more information. - -### XHREVSCAN key [MATCH match] [COUNT count] - -Reverse iterate Hash keys incrementally. - -See [XREVSCAN](#xrevscan-key-match-match-count-count) for more information. - - ### HDUMP key See [DUMP](#dump-key) for more information. @@ -1331,31 +1213,6 @@ ledis> LPERSIST b (integer) 0 ``` -### LXSCAN key [MATCH match] [COUNT count] - -Iterate list keys incrementally. - -See [XSCAN](#xscan-key-match-match-count-count) for more information. - -### LXREVSCAN key [MATCH match] [COUNT count] - -Reverse iterate list keys incrementally. - -See [XREVSCAN](#xrevscan-key-match-match-count-count) for more information. - -### XLSCAN key [MATCH match] [COUNT count] - -Iterate list keys incrementally. - -See [XSCAN](#xscan-key-match-match-count-count) for more information. - -### XLREVSCAN key [MATCH match] [COUNT count] - -Reverse iterate list keys incrementally. - -See [XREVSCAN](#xrevscan-key-match-match-count-count) for more information. - - ### LDUMP key See [DUMP](#dump-key) for more information. @@ -1782,33 +1639,6 @@ ledis> STTL key (integer) -1 ``` -### SXSCAN key [MATCH match] [COUNT count] - -Iterate Set keys incrementally. - -See [XSCAN](#xscan-key-match-match-count-count) for more information. - - -### SXREVSCAN key [MATCH match] [COUNT count] - -Reverse iterate Set keys incrementally. - -See [XREVSCAN](#xrevscan-key-match-match-count-count) for more information. - -### XSSCAN key [MATCH match] [COUNT count] - -Iterate Set keys incrementally. - -See [XSCAN](#xscan-key-match-match-count-count) for more information. - - -### XSREVSCAN key [MATCH match] [COUNT count] - -Reverse iterate Set keys incrementally. - -See [XREVSCAN](#xrevscan-key-match-match-count-count) for more information. - - ### SDUMP key See [DUMP](#dump-key) for more information. @@ -2432,30 +2262,6 @@ ledis> ZRANGE out 0 -1 WITHSCORES 4) "10" ``` -### ZXSCAN key [MATCH match] [COUNT count] - -Iterate ZSet keys incrementally. - -See [XSCAN](#xscan-key-match-match-count-count) for more information. - -### ZXREVSCAN key [MATCH match] [COUNT count] - -Reverse iterate ZSet keys incrementally. - -See [XREVSCAN](#xrevscan-key-match-match-count-count) for more information. - -### XZSCAN key [MATCH match] [COUNT count] - -Iterate ZSet keys incrementally. - -See [XSCAN](#xscan-key-match-match-count-count) for more information. - -### XZREVSCAN key [MATCH match] [COUNT count] - -Reverse iterate ZSet keys incrementally. - -See [XREVSCAN](#xrevscan-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. @@ -2684,29 +2490,60 @@ ledis> BCOUNT flag 5 6 (refer to [PERSIST](#persist-key) api for other types) -### BXSCAN key [MATCH match] [COUNT count] +## Scan -Iterate Bitmap keys incrementally. +### XSCAN type cursor [MATCH match] [COUNT count] -See [XSCAN](#xscan-key-match-match-count-count) for more information. +Iterate data type keys incrementally. -### BXREVSCAN key [MATCH match] [COUNT count] +Type is "KV", "LIST", "HASH", "SET" or "ZSET". +Cursor is the start for the current iteration. +Match is the regexp for checking matched key. +Count is the maximum retrieved elememts number, default is 10. -Reverse iterate Bitmap keys incrementally. +**Return value** -See [XREVSCAN](#xrevscan-key-match-match-count-count) for more information. +an array of two values, first value is the cursor for next iteration, second value is an array of elements. -### XBSCAN key [MATCH match] [COUNT count] +**Examples** -Iterate Bitmap keys incrementally. +``` +ledis>set a 1 +OK +ledis>set b 2 +OK +ledis>set c 3 +OK +127.0.0.1:6380>xscan "KV" "" +1) "" +2) ["a" "b" "c"] +ledis>xscan "KV" "" count 1 +1) "a" +2) ["a"] +ledis>xscan "KV" "a" count 1 +1) "b" +2) ["b"] +ledis>xscan "KV" "b" count 1 +1) "c" +2) ["c"] +ledis>xscan "KV" "c" count 1 +1) "" +2) [] +``` -See [XSCAN](#xscan-key-match-match-count-count) for more information. +### XHSCAN key cursor [MATCH match] [COUNT count] -### XBREVSCAN key [MATCH match] [COUNT count] +Same like [XSCAN type cursor [MATCH match] [COUNT count]](#xscan-type-cursor-match-match-count-count), but return array of elements +contains two elements, a field and a value. -Reverse iterate Bitmap keys incrementally. +### XSSCAN key cursor [MATCH match] [COUNT count] -See [XREVSCAN](#xrevscan-key-match-match-count-count) for more information. +Same like [XSCAN type cursor [MATCH match] [COUNT count]](#xscan-type-cursor-match-match-count-count) + +### XZSCAN key cursor [MATCH match] [COUNT count] + +Same like [XSCAN type cursor [MATCH match] [COUNT count]](#xscan-type-cursor-match-match-count-count), but return array of elements +contains two elements, a member and its associated score. ## Replication