Sha256: e0032cac98d68bf8647e3d80a1861a27360e60459ce7a6009d3aa82ed1747d56

Contents?: true

Size: 1.3 KB

Versions: 19

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

class Redis
  module Commands
    module HyperLogLog
      # Add one or more members to a HyperLogLog structure.
      #
      # @param [String] key
      # @param [String, Array<String>] member one member, or array of members
      # @return [Boolean] true if at least 1 HyperLogLog internal register was altered. false otherwise.
      def pfadd(key, member)
        send_command([:pfadd, key, member], &Boolify)
      end

      # 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.
      #
      # @param [String, Array<String>] keys
      # @return [Integer]
      def pfcount(*keys)
        send_command([:pfcount] + keys.flatten(1))
      end

      # 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.
      #
      # @param [String] dest_key destination key
      # @param [String, Array<String>] source_key source key, or array of keys
      # @return [Boolean]
      def pfmerge(dest_key, *source_key)
        send_command([:pfmerge, dest_key, *source_key], &BoolifySet)
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
redis-5.4.0 lib/redis/commands/hyper_log_log.rb
redis-5.3.0 lib/redis/commands/hyper_log_log.rb
redis-5.2.0 lib/redis/commands/hyper_log_log.rb
redis-5.1.0 lib/redis/commands/hyper_log_log.rb
redis-5.0.8 lib/redis/commands/hyper_log_log.rb
redis-5.0.7 lib/redis/commands/hyper_log_log.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/lib/redis/commands/hyper_log_log.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/lib/redis/commands/hyper_log_log.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/lib/redis/commands/hyper_log_log.rb
redis-5.0.6 lib/redis/commands/hyper_log_log.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/lib/redis/commands/hyper_log_log.rb
redis-5.0.5 lib/redis/commands/hyper_log_log.rb
redis-5.0.4 lib/redis/commands/hyper_log_log.rb
redis-5.0.3 lib/redis/commands/hyper_log_log.rb
redis-5.0.2 lib/redis/commands/hyper_log_log.rb
redis-5.0.1 lib/redis/commands/hyper_log_log.rb
redis-5.0.0 lib/redis/commands/hyper_log_log.rb
redis-5.0.0.beta4 lib/redis/commands/hyper_log_log.rb
redis-5.0.0.beta3 lib/redis/commands/hyper_log_log.rb