TOPK.LIST
TOPK.LIST key [WITHCOUNT]
- Group
- Top-K
- Complexity
- O(k log k), k being the list size
- Arity
- -1 (at least 1 words, counting the command name)
- Flags
- none
- Keys
- first 1, last 1, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
TOPK.LIST returns the items currently kept by the Top-K at key, ordered
by estimated count, highest first.
Options
Section titled “Options”| Option | Effect |
|---|---|
WITHCOUNT |
Follow each item with its estimated count. |
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Default | Array of items (bulk strings) | Same |
WITHCOUNT |
Flat array: item, count, item, count, … | Same |
The list holds fewer than topk items until enough distinct items were
seen.
Error replies: TopK: key does not exist, WITHCOUNT keyword expected for
any other option, and WRONGTYPE.
Examples
Section titled “Examples”127.0.0.1:6379> TOPK.RESERVE trending 3 50 4 0.9OK127.0.0.1:6379> TOPK.INCRBY trending hotkv 10 redis 41) (nil)2) (nil)127.0.0.1:6379> TOPK.LIST trending1) "hotkv"2) "redis"127.0.0.1:6379> TOPK.LIST trending WITHCOUNT1) "hotkv"2) (integer) 103) "redis"4) (integer) 4Compatibility
Section titled “Compatibility”Same as TOPK.LIST in RedisBloom.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.