Module: Redis::Commands::HyperLogLog

Included in:
Redis::Commands
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/lib/redis/commands/hyper_log_log.rb

Instance Method Summary collapse

Instance Method Details

#pfadd(key, member) ⇒ Boolean

Add one or more members to a HyperLogLog structure.

Parameters:

Returns:

  • (Boolean)

    true if at least 1 HyperLogLog internal register was altered. false otherwise.



11
12
13
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/lib/redis/commands/hyper_log_log.rb', line 11

def pfadd(key, member)
  send_command([:pfadd, key, member], &Boolify)
end

#pfcount(*keys) ⇒ Integer

Get the approximate cardinality of members added to HyperLogLog structure.

If called with multiple keys, returns the approximate cardinality of the union of the HyperLogLogs contained in the keys.

Parameters:

Returns:



22
23
24
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/lib/redis/commands/hyper_log_log.rb', line 22

def pfcount(*keys)
  send_command([:pfcount] + keys.flatten(1))
end

#pfmerge(dest_key, *source_key) ⇒ Boolean

Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.

Parameters:

Returns:

  • (Boolean)


32
33
34
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/lib/redis/commands/hyper_log_log.rb', line 32

def pfmerge(dest_key, *source_key)
  send_command([:pfmerge, dest_key, *source_key], &BoolifySet)
end