class RedisRds::SortedStringSet

Constants

DEFAULT_SCORE

Public Instance Methods

add(item) click to toggle source
Calls superclass method RedisRds::SortedSet#add
# File lib/redis_rds/sorted_string_set.rb, line 5
def add(item)
  super(DEFAULT_SCORE, item)
end
all() click to toggle source
# File lib/redis_rds/sorted_string_set.rb, line 13
def all
  return range('-', '+').to_a
end
push(item) click to toggle source
# File lib/redis_rds/sorted_string_set.rb, line 9
def push(item)
  return add(item)
end
range(min, max) click to toggle source
# File lib/redis_rds/sorted_string_set.rb, line 21
def range(min, max)
  min, max = [min, max].map do |r|
    next(r) if ['-', '+'].include?(r) || r.start_with?('[') || r.start_with?('(')
    "[#{r}"
  end

  return connection.zrangebylex(@redis_key, min, max)
end
remove(item) click to toggle source
# File lib/redis_rds/sorted_string_set.rb, line 17
def remove(item)
  return connection.zrem(@redis_key, item)
end