Module: Oxblood::Commands::HyperLogLog

Included in:
Oxblood::Commands
Defined in:
lib/oxblood/commands/hyper_log_log.rb

Instance Method Summary collapse

Instance Method Details

#pfadd(key, *elements) ⇒ Integer

Adds the specified elements to the specified HyperLogLog.


12
13
14
# File 'lib/oxblood/commands/hyper_log_log.rb', line 12

def pfadd(key, *elements)
  run(*elements.unshift(:PFADD, key))
end

#pfcount(*keys) ⇒ Integer

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


24
25
26
# File 'lib/oxblood/commands/hyper_log_log.rb', line 24

def pfcount(*keys)
  run(*keys.unshift(:PFCOUNT))
end

#pfmerge(destkey, *sourcekeys) ⇒ String

Merge N different HyperLogLogs into a single one.


35
36
37
# File 'lib/oxblood/commands/hyper_log_log.rb', line 35

def pfmerge(destkey, *sourcekeys)
  run(*sourcekeys.unshift(:PFMERGE, destkey))
end