class Redis

def zrangebyscore(key, min, max, options = {})

Returns:
  • (Array, Array<[String, Float]>) -

Parameters:
  • options (Hash) --
  • max (String) --
  • min (String) --
  • key (String) --

Other tags:
    Example: Retrieve members and their scores with scores `> 5` -
    Example: Retrieve the first 2 members with score `>= 0` -
    Example: Retrieve members with score `>= 5` and `< 100` -
def zrangebyscore(key, min, max, options = {})
  args = []
  with_scores = options[:with_scores] || options[:withscores]
  args.concat ["WITHSCORES"] if with_scores
  limit = options[:limit]
  args.concat ["LIMIT", *limit] if limit
  synchronize do |client|
    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