Easy Tutorial
❮ Strings Mget Redis Hyperloglog ❯

Redis Zlexcount Command

Redis Sorted Set (sorted set)

The Redis Zlexcount command calculates the number of members within a specified lexicographical range in a sorted set.

Syntax

The basic syntax for the redis Zlexcount command is as follows:

redis 127.0.0.1:6379> ZLEXCOUNT KEY MIN MAX

Available Versions

= 2.8.9

Return Value

The number of members within the specified range.

Example

redis 127.0.0.1:6379> ZADD myzset 0 a 0 b 0 c 0 d 0 e
(integer) 5
redis 127.0.0.1:6379> ZADD myzset 0 f 0 g
(integer) 2
redis 127.0.0.1:6379> ZLEXCOUNT myzset - +
(integer) 7
redis 127.0.0.1:6379> ZLEXCOUNT myzset [b [f
(integer) 5

Redis Sorted Set (sorted set)

❮ Strings Mget Redis Hyperloglog ❯