ZRANK by index

Redis 開発者教育の申込 Redis 定期点検/技術サポート
Redis Technical Support
Redis エンタープライズサーバー
Redis Enterprise Server

member の index(rank) を返す

使い方は zrank key member です。
戻り値は index です。lrange で使う index と同じ概念です。
score 順で index(rank) が付けられ、0 から始まります。score が同じなら member で比較して index を決めます。

Example

コマンド>zrange city 0 -1 withscores
結果> 0) 50 -> New Delhi
1) 60 -> Seoul
2) 70 -> Beijing
3) 80 -> New York
コマンド>zrank city "Seoul"
結果>1
コマンド>zrank city "New York"
結果>3

アニメーションを見る



構文

ZRANK key member

  • このコマンドは version 2.0.0 から使用できます。
  • 時間計算量は O(log(N)+M) です。
関連コマンド ZREVRANGE, LRANGE
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< ZLEXCOUNT ZRANK ZREVRANK >>

Email 返事がかかってなれば、メールでお知らせします。