class Maxwell::Agent::RedisObjects::SortedSet

Attributes

name[R]

Public Class Methods

new(name) click to toggle source
# File lib/maxwell/agent/redis_objects/sorted_set.rb, line 8
def initialize(name)
  @name = name
end

Public Instance Methods

add(score, object) click to toggle source
# File lib/maxwell/agent/redis_objects/sorted_set.rb, line 12
def add(score, object)
  redis { |redis| redis.zadd name, score, object.to_json }
end
all() click to toggle source
# File lib/maxwell/agent/redis_objects/sorted_set.rb, line 20
def all
  redis {|redis| redis.zrange name, 0, -1 }
end
count() click to toggle source
# File lib/maxwell/agent/redis_objects/sorted_set.rb, line 16
def count
  redis {|redis| redis.zcard name }
end
first() click to toggle source
# File lib/maxwell/agent/redis_objects/sorted_set.rb, line 24
def first
  redis { |redis| redis.zrange(name, 0, 0)[0] }
end
remove(item) click to toggle source
# File lib/maxwell/agent/redis_objects/sorted_set.rb, line 28
def remove(item)
  redis { |redis| redis.zrem name, item.to_json }
end