ZREVRANGEBYSCORE

Redis 開発者教育
Redis Developer Course
Redis 定期点検/技術支援
Redis Technical Support
Redis エンタープライズサーバ
Redis Enterprise Server

scoreに範囲を指定して逆順で照会

使い方は zrevrangebyscore key max min です。
max、minはscoreの範囲で、max、minを含め て照会します。
全部照会するためには、+inf,-infを使用します。
zrangebyscoreと比較すると、照会の順序は、 大きい値からで、 maxを前に指定します。
valueとscoreを同時に見るためには、withscoresオプションを使用します。

Example

コマンド>zadd mycom  2009 "Sun microsystems" 1992 Wang 2002 Netscape
結果>3
コマンド>zadd mycom  1998 "Digital Equipment" 2002 K-mart 1987 "American motors"
結果>3
コマンド>zrevrangebyscore mycom +inf -inf withscores
結果> 0) 2009 -> Sun microsystems
1) 2002 -> Netscape
2) 2002 -> K-mart
3) 1998 -> Digital Equipment
4) 1992 -> Wang
5) 1987 -> American motors
コマンド>zrevrangebyscore mycom 2002 1998 withscores
結果> 0) 2002 -> Netscape
1) 2002 -> K-mart
2) 1998 -> Digital Equipment
コマンド>zrevrangebyscore mycom +inf 2005 withscores
結果> 0) 2009 -> Sun microsystems

アニメーション表示



含めないようにするにはmax、minに使用

使い方は zrangebyscore key (max (min です。

Example

コマンド>zrevrangebyscore mycom (2002 (1987 withscores    2002 > score > 1987
結果> 0) 1998 -> Digital Equipment
1) 1992 -> Wang
コマンド>zrevrangebyscore mycom 2002 (1998 withscores    2002 >= score > 1998
結果> 0) 2002 -> Netscape
1) 2002 -> K-mart

アニメーション表示



limit offset count 使用

使い方は zrangebyscore key max min limit offset count です。
offsetはスタート地点を示して、countは照会するmemberの数です。
offsetは0から始めることができ、countが1以上です。0なら照会されません。
limitがあればoffset countいずれもいなければなりません。 省略できません。
page単位の照会に有用に使用することができます。

Example

コマンド>zrevrangebyscore mycom +inf -inf withscores limit 0 3
結果> 0) 2009 -> Sun microsystems
1) 2002 -> Netscape
2) 2002 -> K-mart
コマンド>zrevrangebyscore mycom +inf -inf withscores limit 3 100
結果> 0) 1998 -> Digital Equipment
1) 1992 -> Wang
2) 1987 -> American motors

アニメーション表示



コマンド

ZREVRANGEBYSCORE key max min [withscores] [limit offset count]

  • このコマンドはversion 2.2.0から使用することができます。
  • 論理的処理の所要時間はO(log(N)+M)です。 Nは集合に属するmemberの個数で、 Mはリターンなるmemberの個数です。
関連コマンド ZRANGE, ZREVRANGE, ZREVRANGEBYSCORE, LRANGE
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< ZRANGEBYSCORE ZREVRANGEBYSCORE ZRANGEBYLEX >>

クリック件数 :

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

혹시 처음이세요?
레디스게이트에는 레디스에 대한 많은 정보가 있습니다.
레디스 소개, 명령어, SQL, 클라이언트, 서버, 센티널, 클러스터 등이 있습니다.
혹시 필요한 정보를 찾기 어려우시면 redisgate@gmail.com로 메일 주세요.
제가 찾아서 알려드리겠습니다.
 
close
IP를 기반으로 보여집니다.