Class: Workerholic::SortedSet
- Inherits:
-
Object
- Object
- Workerholic::SortedSet
- Defined in:
- lib/workerholic/sorted_set.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
Instance Method Summary collapse
- #add(serialized_job, score) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(name = 'workerholic:scheduled_jobs') ⇒ SortedSet
constructor
A new instance of SortedSet.
- #peek ⇒ Object
- #remove(score) ⇒ Object
Constructor Details
#initialize(name = 'workerholic:scheduled_jobs') ⇒ SortedSet
Returns a new instance of SortedSet.
5 6 7 8 |
# File 'lib/workerholic/sorted_set.rb', line 5 def initialize(name = 'workerholic:scheduled_jobs') @storage = Storage::RedisWrapper.new @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/workerholic/sorted_set.rb', line 3 def name @name end |
#storage ⇒ Object (readonly)
Returns the value of attribute storage.
3 4 5 |
# File 'lib/workerholic/sorted_set.rb', line 3 def storage @storage end |
Instance Method Details
#add(serialized_job, score) ⇒ Object
10 11 12 |
# File 'lib/workerholic/sorted_set.rb', line 10 def add(serialized_job, score) storage.add_to_set(name, score, serialized_job) end |
#empty? ⇒ Boolean
22 23 24 |
# File 'lib/workerholic/sorted_set.rb', line 22 def empty? storage.sorted_set_size(name) == 0 end |
#peek ⇒ Object
18 19 20 |
# File 'lib/workerholic/sorted_set.rb', line 18 def peek storage.peek(name) end |
#remove(score) ⇒ Object
14 15 16 |
# File 'lib/workerholic/sorted_set.rb', line 14 def remove(score) storage.remove_from_set(name, score) end |