Class ReactiveTopKCommandsImpl<K,V>
- java.lang.Object
-
- io.quarkus.redis.runtime.datasource.AbstractRedisCommands
-
- io.quarkus.redis.runtime.datasource.AbstractTopKCommands<K,V>
-
- io.quarkus.redis.runtime.datasource.ReactiveTopKCommandsImpl<K,V>
-
- All Implemented Interfaces:
ReactiveRedisCommands
,ReactiveTopKCommands<K,V>
public class ReactiveTopKCommandsImpl<K,V> extends AbstractTopKCommands<K,V> implements ReactiveTopKCommands<K,V>, ReactiveRedisCommands
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Class<V>
typeOfValue
-
Fields inherited from class io.quarkus.redis.runtime.datasource.AbstractRedisCommands
marshaller, redis
-
-
Constructor Summary
Constructors Constructor Description ReactiveTopKCommandsImpl(ReactiveRedisDataSourceImpl redis, Class<K> k, Class<V> v)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) Map<V,Integer>
decodeAsMapVInt(io.vertx.mutiny.redis.client.Response r)
(package private) Map<V,V>
decodeAsMapVV(Map<V,Integer> couples, io.vertx.mutiny.redis.client.Response r)
(package private) V
decodeV(io.vertx.mutiny.redis.client.Response r)
ReactiveRedisDataSource
getDataSource()
io.smallrye.mutiny.Uni<V>
topkAdd(K key, V item)
Execute the command TOPK.ADD.io.smallrye.mutiny.Uni<List<V>>
topkAdd(K key, V... items)
Execute the command TOPK.ADD.io.smallrye.mutiny.Uni<Map<V,V>>
topkIncrBy(K key, Map<V,Integer> couples)
Execute the command TOPK.INCRBY.io.smallrye.mutiny.Uni<V>
topkIncrBy(K key, V item, int increment)
Execute the command TOPK.INCRBY.io.smallrye.mutiny.Uni<List<V>>
topkList(K key)
Execute the command TOPK.LIST.io.smallrye.mutiny.Uni<Map<V,Integer>>
topkListWithCount(K key)
Execute the command TOPK.LIST.io.smallrye.mutiny.Uni<Boolean>
topkQuery(K key, V item)
Execute the command TOPK.QUERY.io.smallrye.mutiny.Uni<List<Boolean>>
topkQuery(K key, V... items)
Execute the command TOPK.QUERY.io.smallrye.mutiny.Uni<Void>
topkReserve(K key, int topk)
Execute the command TOPK.RESERVE.io.smallrye.mutiny.Uni<Void>
topkReserve(K key, int topk, int width, int depth, double decay)
Execute the command TOPK.RESERVE.-
Methods inherited from class io.quarkus.redis.runtime.datasource.AbstractTopKCommands
_topkAdd, _topkAdd, _topkIncrBy, _topkIncrBy, _topkList, _topkListWithCount, _topkQuery, _topkQuery, _topkReserve, _topkReserve
-
Methods inherited from class io.quarkus.redis.runtime.datasource.AbstractRedisCommands
execute
-
-
-
-
Constructor Detail
-
ReactiveTopKCommandsImpl
public ReactiveTopKCommandsImpl(ReactiveRedisDataSourceImpl redis, Class<K> k, Class<V> v)
-
-
Method Detail
-
getDataSource
public ReactiveRedisDataSource getDataSource()
- Specified by:
getDataSource
in interfaceReactiveRedisCommands
- Returns:
- the data source.
-
topkAdd
public io.smallrye.mutiny.Uni<V> topkAdd(K key, V item)
Description copied from interface:ReactiveTopKCommands
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- Specified by:
topkAdd
in interfaceReactiveTopKCommands<K,V>
- Parameters:
key
- the name of list where item is added, must not benull
item
- the item to add, must not benull
- Returns:
- a uni producing the item that get expelled if any, emit
null
otherwise
-
topkAdd
public io.smallrye.mutiny.Uni<List<V>> topkAdd(K key, V... items)
Description copied from interface:ReactiveTopKCommands
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- Specified by:
topkAdd
in interfaceReactiveTopKCommands<K,V>
- Parameters:
key
- the name of list where item is added, must not benull
items
- the items to add, must not benull
, must not be empty, must not containnull
- Returns:
- a uni producing a list containing for each corresponding added item the expelled item if any,
null
otherwise.
-
topkIncrBy
public io.smallrye.mutiny.Uni<V> topkIncrBy(K key, V item, int increment)
Description copied from interface:ReactiveTopKCommands
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- Specified by:
topkIncrBy
in interfaceReactiveTopKCommands<K,V>
- Parameters:
key
- the name of list where item is added, must not benull
item
- the item to add, must not benull
increment
- increment to current item score. Increment must be greater or equal to 1. Increment is limited to 100,000 to avoid server freeze.- Returns:
- a uni producing the item that get expelled if any, emit
null
otherwise
-
topkIncrBy
public io.smallrye.mutiny.Uni<Map<V,V>> topkIncrBy(K key, Map<V,Integer> couples)
Description copied from interface:ReactiveTopKCommands
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- Specified by:
topkIncrBy
in interfaceReactiveTopKCommands<K,V>
- Parameters:
key
- the name of list where item is added, must not benull
couples
- The map containing the item / increment, must not benull
, must not be empty- Returns:
- a uni producing a map containing for each added item the expelled item if any,
null
otherwise
-
decodeAsMapVV
Map<V,V> decodeAsMapVV(Map<V,Integer> couples, io.vertx.mutiny.redis.client.Response r)
-
topkList
public io.smallrye.mutiny.Uni<List<V>> topkList(K key)
Description copied from interface:ReactiveTopKCommands
Execute the command TOPK.LIST. Summary: Return full list of items in Top K list. Group: top-k- Specified by:
topkList
in interfaceReactiveTopKCommands<K,V>
- Parameters:
key
- the name of list, must not benull
- Returns:
- a uni producing the list of items
-
topkListWithCount
public io.smallrye.mutiny.Uni<Map<V,Integer>> topkListWithCount(K key)
Description copied from interface:ReactiveTopKCommands
Execute the command TOPK.LIST. Summary: Return full list of items in Top K list. Group: top-k- Specified by:
topkListWithCount
in interfaceReactiveTopKCommands<K,V>
- Parameters:
key
- the name of list, must not benull
- Returns:
- a uni producing the Map of items with the associated count
-
topkQuery
public io.smallrye.mutiny.Uni<Boolean> topkQuery(K key, V item)
Description copied from interface:ReactiveTopKCommands
Execute the command TOPK.QUERY. Summary: Checks whether an item is one of Top-K items. Multiple items can be checked at once. Group: top-k- Specified by:
topkQuery
in interfaceReactiveTopKCommands<K,V>
- Parameters:
key
- the name of list, must not benull
item
- the item to check, must not benull
- Returns:
- a uni producing
true
if the item is in the list,false
otherwise
-
topkQuery
public io.smallrye.mutiny.Uni<List<Boolean>> topkQuery(K key, V... items)
Description copied from interface:ReactiveTopKCommands
Execute the command TOPK.QUERY. Summary: Checks whether an item is one of Top-K items. Multiple items can be checked at once. Group: top-k- Specified by:
topkQuery
in interfaceReactiveTopKCommands<K,V>
- Parameters:
key
- the name of list, must not benull
items
- the items to check, must not benull
, must not containnull
, must not be empty- Returns:
- a uni producing a list containing
true
if the corresponding item is in the list,false
otherwise
-
topkReserve
public io.smallrye.mutiny.Uni<Void> topkReserve(K key, int topk)
Description copied from interface:ReactiveTopKCommands
Execute the command TOPK.RESERVE. Summary: Initializes a TopK with specified parameters. Group: top-k- Specified by:
topkReserve
in interfaceReactiveTopKCommands<K,V>
- Parameters:
key
- the name of list, must not benull
topk
- the number of top occurring items to keep.- Returns:
- a uni producing
null
once the operation completes
-
topkReserve
public io.smallrye.mutiny.Uni<Void> topkReserve(K key, int topk, int width, int depth, double decay)
Description copied from interface:ReactiveTopKCommands
Execute the command TOPK.RESERVE. Summary: Initializes a TopK with specified parameters. Group: top-k- Specified by:
topkReserve
in interfaceReactiveTopKCommands<K,V>
- Parameters:
key
- the name of list, must not benull
topk
- the number of top occurring items to keep.width
- the number of counters kept in each array. (Default 8)depth
- the number of arrays. (Default 7)decay
- the probability of reducing a counter in an occupied bucket. It is raised to power of it's counter (decay ^ bucket[i].counter). Therefore, as the counter gets higher, the chance of a reduction is being reduced. (Default 0.9)- Returns:
- a uni producing
null
once the operation completes
-
decodeV
V decodeV(io.vertx.mutiny.redis.client.Response r)
-
-