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

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

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

import java.util.Map;

import io.quarkus.redis.datasource.string.GetExArgs;
import io.quarkus.redis.datasource.string.ReactiveTransactionalStringCommands;
import io.quarkus.redis.datasource.string.SetArgs;
import io.quarkus.redis.datasource.transactions.ReactiveTransactionalRedisDataSource;
import io.quarkus.redis.datasource.value.ReactiveTransactionalValueCommands;
import io.smallrye.mutiny.Uni;
import io.vertx.mutiny.redis.client.Response;

public class ReactiveTransactionalStringCommandsImpl extends AbstractTransactionalCommands
        implements ReactiveTransactionalStringCommands, ReactiveTransactionalValueCommands {

    private final ReactiveStringCommandsImpl reactive;

    public ReactiveTransactionalStringCommandsImpl(ReactiveTransactionalRedisDataSource ds,
            ReactiveStringCommandsImpl reactive, TransactionHolder tx) {
        super(ds, tx);
        this.reactive = reactive;
    }

    @Override
    public Uni append(K key, V value) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._append(key, value).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni decr(K key) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._decr(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni decrby(K key, long amount) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._decrby(key, amount).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni get(K key) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._get(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni getdel(K key) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._getdel(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni getex(K key, GetExArgs args) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._getex(key, args).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni getex(K key, io.quarkus.redis.datasource.value.GetExArgs args) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._getex(key, args).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni getrange(K key, long start, long end) {
        this.tx.enqueue(Response::toString);
        return this.reactive._getrange(key, start, end).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni getset(K key, V value) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._getset(key, value).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni incr(K key) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._incr(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni incrby(K key, long amount) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._incrby(key, amount).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni incrbyfloat(K key, double amount) {
        this.tx.enqueue(Response::toDouble);
        return this.reactive._incrbyfloat(key, amount).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni lcs(K key1, K key2) {
        this.tx.enqueue(Response::toString);
        return this.reactive._lcs(key1, key2).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni lcsLength(K key1, K key2) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._lcsLength(key1, key2).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni mget(K... keys) {
        this.tx.enqueue(resp -> this.reactive.decodeAsOrderedMap(resp, keys));
        return this.reactive._mget(keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni mset(Map map) {
        this.tx.enqueue(resp -> null);
        return this.reactive._mset(map).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni msetnx(Map map) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._msetnx(map).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni psetex(K key, long milliseconds, V value) {
        this.tx.enqueue(resp -> null);
        return this.reactive._psetex(key, milliseconds, value).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni set(K key, V value) {
        this.tx.enqueue(resp -> null);
        return this.reactive._set(key, value).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni set(K key, V value, SetArgs setArgs) {
        this.tx.enqueue(resp -> null);
        return this.reactive._set(key, value, setArgs).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni set(K key, V value, io.quarkus.redis.datasource.value.SetArgs setArgs) {
        this.tx.enqueue(resp -> null);
        return this.reactive._set(key, value, setArgs).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni setGet(K key, V value) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._setGet(key, value).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni setGet(K key, V value, SetArgs setArgs) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._setGet(key, value, setArgs).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni setGet(K key, V value, io.quarkus.redis.datasource.value.SetArgs setArgs) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._setGet(key, value, setArgs).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni setex(K key, long seconds, V value) {
        this.tx.enqueue(resp -> null);
        return this.reactive._setex(key, seconds, value).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni setnx(K key, V value) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._setnx(key, value).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni setrange(K key, long offset, V value) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._setrange(key, offset, value).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni strlen(K key) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._strlen(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy