io.quarkus.redis.datasource.topk.ReactiveTopKCommands Maven / Gradle / Ivy
Show all versions of quarkus-redis-client Show documentation
package io.quarkus.redis.datasource.topk;
import java.util.List;
import java.util.Map;
import io.quarkus.redis.datasource.ReactiveRedisCommands;
import io.smallrye.mutiny.Uni;
/**
* Allows executing commands from the {@code top-k} group.
* These commands require the Redis Bloom module (this modules also
* include Top-K list support) to be installed in the Redis server.
*
* See the top-k command list for further information about
* these commands.
*
*
* @param the type of the key
* @param the type of the value stored in the sketch
*/
public interface ReactiveTopKCommands extends ReactiveRedisCommands {
/**
* Execute the command TOPK.ADD.
* Summary: Adds an item to the data structure. Multiple items can be added at once.
* If an item enters the Top-K list, the item which is expelled is returned. This allows dynamic heavy-hitter
* detection of items being entered or expelled from Top-K list.
* Group: top-k
*
*
* @param key the name of list where item is added, must not be {@code null}
* @param item the item to add, must not be {@code null}
* @return a uni producing the item that get expelled if any, emit {@code null} otherwise
**/
Uni topkAdd(K key, V item);
/**
* Execute the command TOPK.ADD.
* Summary: Adds an item to the data structure. Multiple items can be added at once.
* If an item enters the Top-K list, the item which is expelled is returned. This allows dynamic heavy-hitter
* detection of items being entered or expelled from Top-K list.
* Group: top-k
*
*
* @param key the name of list where item is added, must not be {@code null}
* @param items the items to add, must not be {@code null}, must not be empty, must not contain {@code null}
* @return a uni producing a list containing for each corresponding added item the expelled item if any,
* {@code null} otherwise.
**/
Uni> topkAdd(K key, V... items);
/**
* Execute the command TOPK.INCRBY.
* Summary: Increase the score of an item in the data structure by increment. Multiple items' score can be increased
* at once. If an item enters the Top-K list, the item which is expelled is returned.
* Group: top-k
*
*
* @param key the name of list where item is added, must not be {@code null}
* @param item the item to add, must not be {@code null}
* @param increment increment to current item score. Increment must be greater or equal to 1. Increment is
* limited to 100,000 to avoid server freeze.
* @return a uni producing the item that get expelled if any, emit {@code null} otherwise
**/
Uni topkIncrBy(K key, V item, int increment);
/**
* Execute the command TOPK.INCRBY.
* Summary: Increase the score of an item in the data structure by increment. Multiple items' score can be increased
* at once. If an item enters the Top-K list, the item which is expelled is returned.
* Group: top-k
*
*
* @param key the name of list where item is added, must not be {@code null}
* @param couples The map containing the item / increment, must not be {@code null}, must not be empty
* @return a uni producing a map containing for each added item the expelled item if any, {@code null} otherwise
**/
Uni