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

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

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

import java.time.Duration;
import java.time.Instant;

import io.quarkus.redis.datasource.keys.CopyArgs;
import io.quarkus.redis.datasource.keys.ExpireArgs;
import io.quarkus.redis.datasource.keys.ReactiveTransactionalKeyCommands;
import io.quarkus.redis.datasource.keys.RedisKeyNotFoundException;
import io.quarkus.redis.datasource.transactions.ReactiveTransactionalRedisDataSource;
import io.smallrye.mutiny.Uni;
import io.vertx.mutiny.redis.client.Response;

public class ReactiveTransactionalKeyCommandsImpl extends AbstractTransactionalCommands
        implements ReactiveTransactionalKeyCommands {

    private final ReactiveKeyCommandsImpl reactive;

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

    @Override
    public Uni copy(K source, K destination) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._copy(source, destination).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni copy(K source, K destination, CopyArgs copyArgs) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._copy(source, destination, copyArgs).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni del(K... keys) {
        this.tx.enqueue(Response::toInteger);
        return this.reactive._del(keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni dump(K key) {
        this.tx.enqueue(Response::toString);
        return this.reactive._dump(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni exists(K key) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._exists(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni exists(K... keys) {
        this.tx.enqueue(Response::toInteger);
        return this.reactive._exists(keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni expire(K key, long seconds, ExpireArgs expireArgs) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._expire(key, seconds, expireArgs).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni expire(K key, Duration duration, ExpireArgs expireArgs) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._expire(key, duration, expireArgs).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni expire(K key, long seconds) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._expire(key, seconds).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni expire(K key, Duration duration) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._expire(key, duration).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni expireat(K key, long timestamp) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._expireat(key, timestamp).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni expireat(K key, Instant timestamp) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._expireat(key, timestamp).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni expireat(K key, long timestamp, ExpireArgs expireArgs) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._expireat(key, timestamp, expireArgs).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni expireat(K key, Instant timestamp, ExpireArgs expireArgs) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._expireat(key, timestamp, expireArgs).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni expiretime(K key) {
        this.tx.enqueue(resp -> this.reactive.decodeExpireResponse(key, resp));
        return this.reactive._expiretime(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni keys(String pattern) {
        this.tx.enqueue(this.reactive::decodeKeys);
        return this.reactive._keys(pattern).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni move(K key, long db) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._move(key, db).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni persist(K key) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._persist(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni pexpire(K key, Duration duration, ExpireArgs expireArgs) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._pexpire(key, duration, expireArgs).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni pexpire(K key, long ms) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._pexpire(key, ms).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni pexpire(K key, Duration duration) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._pexpire(key, duration).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni pexpire(K key, long milliseconds, ExpireArgs expireArgs) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._pexpire(key, milliseconds, expireArgs).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni pexpireat(K key, long timestamp) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._pexpireat(key, timestamp).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni pexpireat(K key, Instant timestamp) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._pexpireat(key, timestamp).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni pexpireat(K key, long timestamp, ExpireArgs expireArgs) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._pexpireat(key, timestamp, expireArgs).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni pexpireat(K key, Instant timestamp, ExpireArgs expireArgs) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._pexpireat(key, timestamp, expireArgs).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni pexpiretime(K key) {
        this.tx.enqueue(resp -> this.reactive.decodeExpireResponse(key, resp));
        return this.reactive._pexpiretime(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni pttl(K key) {
        this.tx.enqueue(resp -> this.reactive.decodeExpireResponse(key, resp));
        return this.reactive._pttl(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni randomkey() {
        this.tx.enqueue(this.reactive::decodeK);
        return this.reactive._randomkey().invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni rename(K key, K newkey) {
        this.tx.enqueue(resp -> null);
        return this.reactive._rename(key, newkey).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni renamenx(K key, K newkey) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._renamenx(key, newkey).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni touch(K... keys) {
        this.tx.enqueue(Response::toInteger);
        return this.reactive._touch(keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni ttl(K key) throws RedisKeyNotFoundException {
        this.tx.enqueue(resp -> this.reactive.decodeExpireResponse(key, resp));
        return this.reactive._ttl(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni type(K key) {
        this.tx.enqueue(this.reactive::decodeRedisType);
        return this.reactive._type(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni unlink(K... keys) {
        this.tx.enqueue(Response::toInteger);
        return this.reactive._unlink(keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy