Reputation: 6039
I have a redis dump, which contains key/value pairs of type String/Double. Is it possible to get all the keys (or theirs counts), which have value more than a given number?
Upvotes: 0
Views: 2155
Reputation: 13124
You can do that if you use a SortedSet with your double as the score and your string as the member, and then you can ZRANGEBYSCORE.
For example, to get all the members with a score greater than 1:
> ZADD zzz 1 one 2 two 3 three
(integer) 3
> ZRANGEBYSCORE zzz (1 +inf WITHSCORES
1) "two"
2) 2.0
3) "three"
4) 3.0
Upvotes: 1