| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Database.Redis.ManualCommands.Topk
Synopsis
- data TopkInfo = TopkInfo {}
- topkAdd :: RedisCtx m f => ByteString -> NonEmpty ByteString -> m (f [Maybe ByteString])
- topkCount :: RedisCtx m f => ByteString -> NonEmpty ByteString -> m (f [Integer])
- topkIncrby :: RedisCtx m f => ByteString -> NonEmpty (ByteString, Integer) -> m (f [Maybe ByteString])
- topkInfo :: RedisCtx m f => ByteString -> m (f TopkInfo)
- topkList :: RedisCtx m f => ByteString -> m (f [ByteString])
- topkListWithCount :: RedisCtx m f => ByteString -> m (f [(ByteString, Integer)])
- topkReserve :: RedisCtx m f => ByteString -> Integer -> Integer -> Integer -> Double -> m (f Status)
- topkQuery :: RedisCtx m f => ByteString -> NonEmpty ByteString -> m (f [Bool])
Documentation
Constructors
| TopkInfo | |
Fields
| |
Arguments
| :: RedisCtx m f | |
| => ByteString | Key of the Top-K sketch. |
| -> NonEmpty ByteString | Items to add. |
| -> m (f [Maybe ByteString]) |
Adds one or more items to a Top-K sketch (https://redis.io/commands/topk.add).
Returns the items dropped from the sketch after each insertion, or Nothing when no item was expelled.
O(n cdot d), where n is the number of items and d is the depth of the sketch.
Since RedisBloom 2.0.0
Arguments
| :: RedisCtx m f | |
| => ByteString | Key of the Top-K sketch. |
| -> NonEmpty ByteString | Items to count. |
| -> m (f [Integer]) |
Returns the count for one or more items in a Top-K sketch (https://redis.io/commands/topk.count).
Returns 0 for items that are not tracked by the sketch.
O(n cdot d), where n is the number of items and d is the depth of the sketch.
Since RedisBloom 2.0.0
Arguments
| :: RedisCtx m f | |
| => ByteString | Key of the Top-K sketch. |
| -> NonEmpty (ByteString, Integer) | Item and increment pairs. |
| -> m (f [Maybe ByteString]) |
Increments the count of one or more items by a configured amount (https://redis.io/commands/topk.incrby).
Returns the items dropped from the sketch after each increment, or Nothing when no item was expelled.
O(n cdot d), where n is the number of item-increment pairs and d is the depth of the sketch.
Since RedisBloom 2.0.0
Since RedisBloom 2.0.0
Arguments
| :: RedisCtx m f | |
| => ByteString | Key of the Top-K sketch. |
| -> m (f [ByteString]) |
Returns the items in a Top-K sketch (https://redis.io/commands/topk.list).
O(k), where k is the configured top-k size.
Since RedisBloom 2.0.0
Arguments
| :: RedisCtx m f | |
| => ByteString | Key of the Top-K sketch. |
| -> m (f [(ByteString, Integer)]) |
Returns the items in a Top-K sketch along with their approximated counts (https://redis.io/commands/topk.list).
O(k), where k is the configured top-k size.
Since RedisBloom 2.0.0
Arguments
| :: RedisCtx m f | |
| => ByteString | Key of the Top-K sketch to create. |
| -> Integer | Number of items to keep in the sketch. |
| -> Integer | Number of counters in each array. |
| -> Integer | Number of counter arrays. |
| -> Double | Decay factor. |
| -> m (f Status) |
Creates an empty Top-K sketch (https://redis.io/commands/topk.reserve).
The sketch will fail to be created if the key already exists.
O(1)
Since RedisBloom 2.0.0
Arguments
| :: RedisCtx m f | |
| => ByteString | Key of the Top-K sketch. |
| -> NonEmpty ByteString | Items to check. |
| -> m (f [Bool]) |
Checks whether one or more items are present in a Top-K sketch (https://redis.io/commands/topk.query).
A False value means the item is not currently one of the tracked heavy hitters.
O(n cdot d), where n is the number of items and d is the depth of the sketch.
Since RedisBloom 2.0.0