Interface RedisHyperlogCommands

  • All Known Implementing Classes:
    RedisConnection

    public interface RedisHyperlogCommands
    Interface for Redis HyperlogLog management.
    Author:
    Matthew Tropiano
    • Method Detail

      • pfadd

        boolean pfadd​(String key,
                      String element,
                      String... elements)

        From http://redis.io/commands/pfadd:

        Available since 2.8.9.

        Time complexity: O(1) to add every element.

        Adds all the element arguments to the HyperLogLog data structure stored at the variable name specified as first argument.

        Parameters:
        key - the hyperlog key.
        element - the first element.
        elements - the rest of the elements.
        Returns:
        true if at least one internal register was altered, false otherwise.
      • pfcount

        long pfcount​(String key,
                     String... keys)

        From http://redis.io/commands/pfcount:

        Available since 2.8.9.

        Time complexity: O(1).

        Returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable, which is 0 if the variable does not exist.

        Parameters:
        key - the first key.
        keys - the rest of the keys.
        Returns:
        the number of unique elements observed via pfadd(String, String, String...).
      • pfmerge

        boolean pfmerge​(String destkey,
                        String sourcekey,
                        String... sourcekeys)

        From http://redis.io/commands/pfmerge:

        Available since 2.8.9.

        Time complexity: O(N) to merge N HyperLogLogs, but with high constant times.

        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:
        destkey - the destination key.
        sourcekey - the first key.
        sourcekeys - the rest of the keys.
        Returns:
        always true.