zrevrangebylex
ZREVRANGEBYLEX
Redis 開発者教育の申込
|
Redis 定期点検/技術サポートRedis Technical Support |
Redis エンタープライズサーバーRedis Enterprise Server |
|---|
member で範囲を指定して逆順(大きいものから)照会
使い方は zrevrangebylex key max min です。
max、min は member の範囲です。すべて照会するには +, - を使います。
max、min に値を付ける場合は必ず前に [ または ( を使う必要があります。
[ は値を含むときに使い、( は除外するときに使います。
このコマンドは score がすべて同じでなければ望む結果を得られません。
このコマンドには withscores オプションがありません。
Example
| コマンド> | zrevrangebylex city + - |
| 結果> |
0) Seoul 1) New York 2) New Delhi 3) Beijing |
| コマンド> | zrevrangebylex city + "[New Delhi" |
| 結果> |
0) Seoul 1) New York 2) New Delhi |
| コマンド> | zrevrangebylex city "(Seoul" "[New Delhi" |
| 結果> |
0) New York 1) New Delhi |
| コマンド> | zrevrangebylex city "(Seoul" "(New Delhi" |
| 結果> |
0) New York |
limit offset count の使用
使い方は zrevrangebylex key max minlimit offset count です。
offset は開始点を示し、count は照会する member の個数です。
offset は 0 から始められ、count は 1 以上でなければなりません。0 だと照会されません。
limit がある場合は offset count の両方が必要です。
ページ別照会に便利です。<
Example
| コマンド> | zrevrangebylex city + -limit 0 2 |
| 結果> |
0) Seoul 1) New York |
| コマンド> | zrevrangebylex city - + limit 2 2 |
| 結果> |
0) New Delhi 1) Beijing |
構文
ZREVRANGEBYLEX key max min [limit offset count]
- このコマンドは version 2.8.9 から使用できます。
- 時間計算量は O(log(N)+M) です。 N は集合に属する member 個数で、 M は削除される member 個数です。
| 関連コマンド | ZRANGE, ZREVRANGE, ZREVRANGEBYSCORE, LRANGE |
| Clients for Java | Jedis, Lettuce, Redisson | Clients for C | Hiredis |
| << ZRANGEBYLEX | ZREVRANGEBYLEX | ZCARD >> |
|---|
Email
返事がかかってなれば、メールでお知らせします。
