TOPK.INCRBY
TOPK.INCRBY key item increment [item increment ...]
- Available in:
- Redis Open Source / Bloom 2.0.0
- Time complexity:
- O(n * k * incr) where n is the number of items, k is the depth and incr is the increment
- ACL categories:
-
@topk,@write,@slow, - Compatibility:
- Redis Software and Redis Cloud compatibility
Increase the score of an item in the data structure by increment.
Multiple items' scores can be increased at once.
If an item enters the Top-K list, the item that is expelled (if any) is returned.
Required arguments
key
the name of the sketch.
item increment [item increment ...]
One or more item-increment pairs. Each item is incremented by its corresponding increment. The increment must be greater than or equal to 1 and less than or equal to 100,000 to avoid server freeze.
Examples
redis> TOPK.INCRBY topk foo 3 bar 2 42 30
1) (nil)
2) (nil)
3) foo
Redis Software and Redis Cloud compatibility
| Redis Software |
Redis Cloud |
Notes |
|---|---|---|
| ✅ Supported |
✅ Flexible & Annual ✅ Free & Fixed |
Return information
One of the following:
- Array of bulk string replies containing either dropped elements or nil (null bulk string).
- Simple error reply in these cases: incorrect number of arguments, non-existant key, key of the incorrect type, or an incorrect increment (less than 0 or greater than 100,000).