TOPK.RESERVE
TOPK.RESERVE key topk [width depth decay]
- Available in:
- Redis Open Source / Bloom 2.0.0
- Time complexity:
- O(1)
- ACL categories:
-
@topk,@write,@fast, - Compatibility:
- Redis Software and Redis Cloud compatibility
Initializes a Top-K sketch with specified parameters.
Required arguments
key
the name of the Top-k sketch.
topk
the number of top (k) occurring items to keep.
Optional arguments
width
Number of counters kept in each array. (Default 8)
depth
Number of arrays. (Default 7)
decay
The probability of reducing a counter in an occupied bucket (decay ^ bucket[i].counter). As the counter gets higher, the likelihood of a reduction is lower. (Default 0.9)
Examples
redis> TOPK.RESERVE topk 50 2000 7 0.925
OK
Redis Software and Redis Cloud compatibility
| Redis Software |
Redis Cloud |
Notes |
|---|---|---|
| ✅ Supported |
✅ Flexible & Annual ✅ Free & Fixed |
Return information
One of the following:
- Simple string reply
OKif executed correctly. - Simple error reply in these cases: incorrect number of arguments, invalid decay value, or key already exists.