redis之HyperLogLog

  HyperLogLog weight to provide inaccurate counting scheme, although not very precise but imprecise, the standard error is 0.81%.

Instructions

  HyperLogLog and provides two instructions pfadd pfcount, according to the literal meaning is well understood, increasing a count, a count is acquired.

127.0.0.1:6379> pfadd codehole user1
(integer) 1
127.0.0.1:6379> pfcount codehole
(integer) 1
127.0.0.1:6379> pfadd codehole user2
(integer) 1
127.0.0.1:6379> pfcount codehole
(integer) 2
127.0.0.1:6379> pfadd codehole user3
(integer) 1
127.0.0.1:6379> pfcount codehole
(integer) 3
127.0.0.1:6379> pfadd codehole user4
(integer) 1
127.0.0.1:6379> pfcount codehole
(integer) 4
127.0.0.1:6379> pfadd codehole user5
(integer) 1
127.0.0.1:6379> pfcount codehole
(integer) 5
127.0.0.1:6379> pfadd codehole user6
(integer) 1
127.0.0.1:6379> pfcount codehole
(integer) 6
127.0.0.1:6379> pfadd codehole user7 user8 user9 user10
(integer) 1
127.0.0.1:6379> pfcount codehole
(integer) 10

HyperLogLog addition to the above pfadd and pfcount, also provides a third instruction pfmerge, for adding together a plurality of count values ​​pf pf form a new value.

 

Guess you like

Origin www.cnblogs.com/wuwuyong/p/11741507.html