Available since 2.0.0.

ZCOUNT key min max

Returns the number of elements in the sorted set at key with a score between min and max.

The min and max arguments have the same semantic as described for ZRANGEBYSCORE.

If the key does not exist then ZERO is returned.

Note: the command has a complexity of just O(log(N)) because it uses elements ranks (see ZRANK) to get an idea of the range. Because of this there is no need to do a work proportional to the size of the range. This may not be true for the unit-redis-ness implementation

Return value
Integer reply: the number of elements in the specified score range.

Hierarchy

Constructors

Properties

DEFAULT_ERROR: string = "ERR min or max is not a float"
DbDataType: DataType = DataType.ZSET
blocking?: boolean
dataType?: DataType

Used for "database" commands to enforce type checking.

logger: Logger = ...
maxParams: number = 3

Maximum number of parameters allowed. -1 for no maximum.

minParams: number = 3

Minimum number of parameters require.

name: string = "zcount"
pubSubAllowed?: boolean

Used when PUB/SUB is in effect.

sign?: number

Sign is used in commands with a compliment command. The only current example is INCR/DECR. Sign is 1 for INCR and -1 for DECR

txIgnore?: boolean

Used in transactions to enqueue a command.

Methods