io.quarkus.redis.runtime.datasource.ReactiveTopKCommandsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-redis-client Show documentation
Show all versions of quarkus-redis-client Show documentation
Connect to Redis in either imperative or reactive style
package io.quarkus.redis.runtime.datasource;
import java.lang.reflect.Type;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import io.quarkus.redis.datasource.ReactiveRedisCommands;
import io.quarkus.redis.datasource.ReactiveRedisDataSource;
import io.quarkus.redis.datasource.topk.ReactiveTopKCommands;
import io.smallrye.mutiny.Uni;
import io.vertx.mutiny.redis.client.Response;
public class ReactiveTopKCommandsImpl extends AbstractTopKCommands
implements ReactiveTopKCommands, ReactiveRedisCommands {
private final ReactiveRedisDataSource reactive;
final Type typeOfValue;
public ReactiveTopKCommandsImpl(ReactiveRedisDataSourceImpl redis, Type k, Type v) {
super(redis, k, v);
this.typeOfValue = v;
this.reactive = redis;
}
@Override
public ReactiveRedisDataSource getDataSource() {
return reactive;
}
@Override
public Uni topkAdd(K key, V item) {
return super._topkAdd(key, item)
.map(r -> marshaller. decodeAsList(r, typeOfValue).get(0));
}
@Override
public Uni> topkAdd(K key, V... items) {
return super._topkAdd(key, items)
.map(r -> marshaller.decodeAsList(r, typeOfValue));
}
@Override
public Uni topkIncrBy(K key, V item, int increment) {
return super._topkIncrBy(key, item, increment)
.map(r -> marshaller. decodeAsList(r, typeOfValue).get(0));
}
@Override
public Uni
© 2015 - 2025 Weber Informatics LLC | Privacy Policy