TOPK.INCRBY
Syntax
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 Enterprise 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.
Parameters
- key: the name of the sketch.
- item: the items to be incremented.
- increment: the value by which items will be incremented. The
incrementmust be greater or equal to 1 and less than or equal to 100,000 to avoid server freeze.
Return
Array of Simple string reply - if an element was dropped from the TopK list, Nil reply otherwise..
Example
redis> TOPK.INCRBY topk foo 3 bar 2 42 30
1) (nil)
2) (nil)
3) foo
Redis Enterprise and Redis Cloud compatibility
| Redis Enterprise |
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).