module Protocol::Redis::Methods::Counting

Public Instance Methods

pfadd(key, element, *elements) click to toggle source

Adds the specified elements to the specified HyperLogLog. O(1) to add every element. @see redis.io/commands/pfadd @param key [Key] @param element [String]

# File lib/protocol/redis/methods/counting.rb, line 31
def pfadd(key, element, *elements)
        call("PFADD", key, element, *elements)
end
pfcount(key, *keys) click to toggle source

Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s). O(1) with a very small average constant time when called with a single key. O(N) with N being the number of keys, and much bigger constant times, when called with multiple keys. @see redis.io/commands/pfcount @param key [Key]

# File lib/protocol/redis/methods/counting.rb, line 38
def pfcount(key, *keys)
        call("PFCOUNT", key, *keys)
end
pfmerge(destkey, sourcekey, *sourcekeys) click to toggle source

Merge N different HyperLogLogs into a single one. O(N) to merge N HyperLogLogs, but with high constant times. @see redis.io/commands/pfmerge @param destkey [Key] @param sourcekey [Key]

# File lib/protocol/redis/methods/counting.rb, line 46
def pfmerge(destkey, sourcekey, *sourcekeys)
        call("PFMERGE", destkey, sourcekey, *sourcekeys)
end