ZCOUNT

Since 1.1.0Sorted sets

Syntax

ZCOUNT key min max
  • Flags: fast, readonly
  • ACL categories: @fast, @read, @sortedset
  • Arity: 4

Counts the members of the sorted set at key with a score between min and max. The bounds are included; ( before a bound excludes it, as in (2. -inf and +inf are open ends.

Reply

  • The count.

Examples

> ZADD r 1 a 2 b 3 c 4 d
(integer) 4
> ZCOUNT r 2 3
(integer) 2
> ZCOUNT r (2 3
(integer) 1
> ZCOUNT r -inf +inf
(integer) 4