Latest web development tutorials

Redis Pfcount 命令

Redis HyperLogLog

Redis Pfcount 命令返回給定HyperLogLog 的基數估算值。

語法

redis Pfcount 命令基本語法如下:

redis 127.0.0.1:6379> PFCOUNT key [key ...]

可用版本

>= 2.8.9

返回值

整數,返回給定HyperLogLog 的基數值,如果多個HyperLogLog 則返回基數估值之和。

實例

redis 127.0.0.1:6379> PFADD hll foo bar zap
(integer) 1
redis 127.0.0.1:6379> PFADD hll zap zap zap
(integer) 0
redis 127.0.0.1:6379> PFADD hll foo bar
(integer) 0
redis 127.0.0.1:6379> PFCOUNT hll
(integer) 3
redis 127.0.0.1:6379> PFADD some-other-hll 1 2 3
(integer) 1
redis 127.0.0.1:6379> PFCOUNT hll some-other-hll
(integer) 6
redis> 

Redis HyperLogLog