Method: Redis::Commands::SortedSets#zremrangebyscore

Defined in:
lib/redis/commands/sorted_sets.rb

#zremrangebyscore(key, min, max) ⇒ Integer

Remove all members in a sorted set within the given scores.

Examples:

Remove members with score ‘>= 5` and `< 100`

redis.zremrangebyscore("zset", "5", "(100")
  # => 2

Remove members with scores ‘> 5`

redis.zremrangebyscore("zset", "(5", "+inf")
  # => 2

Parameters:

  • key (String)
  • min (String)
    • inclusive minimum score is specified verbatim

    • exclusive minimum score is specified by prefixing ‘(`

  • max (String)
    • inclusive maximum score is specified verbatim

    • exclusive maximum score is specified by prefixing ‘(`

Returns:

  • (Integer)

    number of members that were removed



591
592
593
# File 'lib/redis/commands/sorted_sets.rb', line 591

def zremrangebyscore(key, min, max)
  send_command([:zremrangebyscore, key, min, max])
end