RedisのZcountコマンド
RedisのZcountコマンドは、スコア範囲指定された順序付きセット内のメンバーの数を計算するために使用されます。
文法
次のようにRedisのZcount基本的なコマンドの構文は次のとおりです。
redis 127.0.0.1:6379> ZCOUNT key min max
利用可能なバージョン
> = 2.0.0
戻り値
minとmaxの間のメンバーの分数。
例
redis 127.0.0.1:6379> ZADD myzset 1 "hello" (integer) 1 redis 127.0.0.1:6379> ZADD myzset 1 "foo" (integer) 1 redis 127.0.0.1:6379> ZADD myzset 2 "world" 3 "bar" (integer) 2 redis 127.0.0.1:6379> ZCOUNT myzset 1 3 (integer) 4