All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.redis.runtime.datasource.AbstractHyperLogLogCommands Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
package io.quarkus.redis.runtime.datasource;

import static io.quarkus.redis.runtime.datasource.Validation.notNullOrEmpty;
import static io.smallrye.mutiny.helpers.ParameterValidation.doesNotContainNull;
import static io.smallrye.mutiny.helpers.ParameterValidation.nonNull;

import java.lang.reflect.Type;

import io.smallrye.mutiny.Uni;
import io.vertx.mutiny.redis.client.Command;
import io.vertx.mutiny.redis.client.Response;

class AbstractHyperLogLogCommands extends AbstractRedisCommands {

    AbstractHyperLogLogCommands(RedisCommandExecutor api, Type k, Type v) {
        super(api, new Marshaller(k, v));
    }

    Uni _pfadd(K key, V... values) {
        nonNull(key, "key");
        notNullOrEmpty(values, "values");
        doesNotContainNull(values, "values");
        RedisCommand cmd = RedisCommand.of(Command.PFADD)
                .put(marshaller.encode(key))
                .putAll(marshaller.encode(values));
        return execute(cmd);
    }

    Uni _pfmerge(K destination, K... sources) {
        nonNull(destination, "destination");
        notNullOrEmpty(sources, "sources");
        doesNotContainNull(sources, "sources");
        RedisCommand cmd = RedisCommand.of(Command.PFMERGE)
                .put(marshaller.encode(destination))
                .putAll(marshaller.encode(sources));
        return execute(cmd);
    }

    Uni _pfcount(K... keys) {
        notNullOrEmpty(keys, "keys");
        doesNotContainNull(keys, "keys");
        return execute(RedisCommand.of(Command.PFCOUNT).put(marshaller.encode(keys)));
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy