Module Hub Beta

TOPK.PRANK

key ele [ele ...]

Computes the percentile rank for one or more elements.

Return Value

Array reply: an array of integers between 0 and 99 representing each element’s percentile rank, NULL if the element isn’t in the TopK Sorted Set.

Examples

redis> 5 TOPK.ADD tk 3 foo
(integer) 1
(integer) 0
(integer) 0
(integer) 0
(integer) 0
redis> 3 TOPK.ADD tk 3 bar
(integer) 1
(integer) 0
(integer) 0
redis> TOPK.ADD tk 3 baz
(integer) 1
redis> TOPK.PRANK tk foo bar baz
1) (integer) 100
2) (integer) 44
3) (integer) 11

© 2017 Redis Labs, Inc. All rights reserved.