Method: Redis#zrangebyscore
- Defined in:
- lib/redis.rb
#zrangebyscore(key, min, max, options = {}) ⇒ Array<String>, Array<[String, Float]>
Return a range of members in a sorted set, by score.
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 |
# File 'lib/redis.rb', line 1001 def zrangebyscore(key, min, max, = {}) args = [] with_scores = [:with_scores] || [:withscores] args.concat ["WITHSCORES"] if with_scores limit = [:limit] args.concat ["LIMIT", *limit] if limit synchronize do @client.call [:zrangebyscore, key, min, max, *args] do |reply| if with_scores if reply reply.each_slice(2).map do |member, score| [member, Float(score)] end end else reply end end end end |