TOPK.COUNT
TOPK.COUNT key item [item ...]
- Group
- Top-K
- Complexity
- O(n * depth), n being the items
- 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.COUNT returns the estimated count of each item in the Top-K at
key, whether or not the item is currently in the list. Estimates are
approximate, especially for rare items; use
TOPK.LIST WITHCOUNT for the counts of the listed
items.
Return value
Section titled “Return value”An array with one integer per item (0 for an item never seen), the same in
RESP2 and RESP3.
Error replies: TopK: key does not exist, and WRONGTYPE if the key holds
another type.
Examples
Section titled “Examples”127.0.0.1:6379> TOPK.RESERVE trending 2 50 4 0.9OK127.0.0.1:6379> TOPK.INCRBY trending hotkv 10 redis 41) (nil)2) (nil)127.0.0.1:6379> TOPK.COUNT trending hotkv redis memcached1) (integer) 102) (integer) 43) (integer) 0Compatibility
Section titled “Compatibility”Same as TOPK.COUNT in RedisBloom, where the command is deprecated in favor
of TOPK.LIST WITHCOUNT. HotKV keeps it supported.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.