Description Usage Arguments Details Value Author(s) References See Also Examples
redisPfadd
Adds all the element arguments to the HyperLogLog data structure stored at the
key name specified as first argument.
redisPfcount
When called with a single key, returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable, which is 0 if the variable does not exist.
When called with multiple keys, returns the approximated cardinality of the union of the HyperLogLogs passed, by internally merging the HyperLogLogs stored at the provided keys into a temporary HyperLogLog.
redisPfmerge
Merge multiple HyperLogLog values into a unique value that will approximate
the cardinality of the union of the observed Sets of the source HyperLogLog
structures.
1 2 3 | redisPfadd(key, elements)
redisPfcount(keys)
redisPfmerge(destkey, sourcekeys)
|
key |
A Redis key name corresponding to a HyperLogLog value. |
keys |
A Redis key name or a vector of Redis key names corresponding to HyperLogLog values. |
elements |
A vector or list of elements to add to the HyperLogLog data structure associated with |
destkey |
The computed merged HyperLogLog is set to the destination key, which is created if does not exist (defaulting to an empty HyperLogLog). |
sourcekeys |
A single key name or vector of Redis key names corresponding to HyperLogLog values to be merged into a unqiue value. |
The HyperLogLog data structure can be used in order to count unique elements in a set using just a small constant amount of memory, specifically 12k bytes for every HyperLogLog (plus a few bytes for the key itself).
The returned cardinality of the observed set is not exact, but approximated
with a standard error of 0.81%. For example in order to take the count of all
the unique search queries performed in a day, a program needs to call
redisPfadd
every time a query is processed. The estimated number of
unique queries can be retrieved with PFCOUNT at any time.
redisPfadd
returns "1" if at least 1 HyperLogLog internal register was altered, "0" otherwise.
redisPfcount
returns a Redis integer value as a character string
corresponding to the approximated number of unique elements observed.
redisPfmerge
just returns "OK".
B. W. Lewis
http://redis.io/commands
redisPfadd
redisPfcount
redisPfmerge
1 2 3 4 5 6 7 8 9 10 | ## Not run:
redisPfadd("testcounter", letters[1:10])
redisPfadd("testcounter", letters[1:20])
redisPfcount("testcounter")
redisPfadd("testcounter_2", "z")
redisPfmerge("testcounter", "testcounter_2")
redisPfcount("testcounter")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.