PFCOUNT command in redis

PFCOUNT key [key ...]

Returns the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).

Redis PFCOUNT command is used to get the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable.

Note: If the key does not exist, then it returns 0.

RETURN VALUE

Integer reply, the approximated number of unique elements.

Syntax:

PFCOUNT key [key ...]

Example 1: When the key is present

redis:6379> PFADD mykey a b c d e f g h
(integer) 1
redis:6379> PFADD mykey Hello
(integer) 1
redis:6379> PFCOUNT mykey
(integer) 9

Output

9


Example 2: When the key is not present

redis:6379> PFCOUNT redisKey
(integer) 0

Output

0


No comments:

Post a Comment