Class: Resque::DataStore::FailedQueueAccess
- Inherits:
-
Object
- Object
- Resque::DataStore::FailedQueueAccess
- Defined in:
- lib/resque/data_store.rb
Instance Method Summary collapse
- #add_failed_queue(failed_queue_name) ⇒ Object
- #clear_failed_queue(failed_queue_name = :failed) ⇒ Object
- #failed_queue_names(find_queue_names_in_key = nil) ⇒ Object
-
#initialize(redis) ⇒ FailedQueueAccess
constructor
A new instance of FailedQueueAccess.
- #num_failed(failed_queue_name = :failed) ⇒ Object
- #push_to_failed_queue(data, failed_queue_name = :failed) ⇒ Object
- #remove_failed_queue(failed_queue_name = :failed) ⇒ Object
- #remove_from_failed_queue(index_in_failed_queue, failed_queue_name = nil) ⇒ Object
- #update_item_in_failed_queue(index_in_failed_queue, new_item_data, failed_queue_name = :failed) ⇒ Object
Constructor Details
#initialize(redis) ⇒ FailedQueueAccess
Returns a new instance of FailedQueueAccess.
170 171 172 |
# File 'lib/resque/data_store.rb', line 170 def initialize(redis) @redis = redis end |
Instance Method Details
#add_failed_queue(failed_queue_name) ⇒ Object
174 175 176 |
# File 'lib/resque/data_store.rb', line 174 def add_failed_queue(failed_queue_name) @redis.sadd(:failed_queues, failed_queue_name) end |
#clear_failed_queue(failed_queue_name = :failed) ⇒ Object
198 199 200 |
# File 'lib/resque/data_store.rb', line 198 def clear_failed_queue(failed_queue_name=:failed) @redis.del(failed_queue_name) end |
#failed_queue_names(find_queue_names_in_key = nil) ⇒ Object
186 187 188 189 190 191 192 |
# File 'lib/resque/data_store.rb', line 186 def failed_queue_names(find_queue_names_in_key=nil) if find_queue_names_in_key.nil? [:failed] else Array(@redis.smembers(find_queue_names_in_key)) end end |
#num_failed(failed_queue_name = :failed) ⇒ Object
182 183 184 |
# File 'lib/resque/data_store.rb', line 182 def num_failed(failed_queue_name=:failed) @redis.llen(failed_queue_name).to_i end |
#push_to_failed_queue(data, failed_queue_name = :failed) ⇒ Object
194 195 196 |
# File 'lib/resque/data_store.rb', line 194 def push_to_failed_queue(data,failed_queue_name=:failed) @redis.rpush(failed_queue_name,data) end |
#remove_failed_queue(failed_queue_name = :failed) ⇒ Object
178 179 180 |
# File 'lib/resque/data_store.rb', line 178 def remove_failed_queue(failed_queue_name=:failed) @redis.del(failed_queue_name) end |
#remove_from_failed_queue(index_in_failed_queue, failed_queue_name = nil) ⇒ Object
206 207 208 209 210 211 |
# File 'lib/resque/data_store.rb', line 206 def remove_from_failed_queue(index_in_failed_queue,failed_queue_name=nil) failed_queue_name ||= :failed hopefully_unique_value_we_can_use_to_delete_job = "" @redis.lset(failed_queue_name, index_in_failed_queue, hopefully_unique_value_we_can_use_to_delete_job) @redis.lrem(failed_queue_name, 1, hopefully_unique_value_we_can_use_to_delete_job) end |
#update_item_in_failed_queue(index_in_failed_queue, new_item_data, failed_queue_name = :failed) ⇒ Object
202 203 204 |
# File 'lib/resque/data_store.rb', line 202 def update_item_in_failed_queue(index_in_failed_queue,new_item_data,failed_queue_name=:failed) @redis.lset(failed_queue_name, index_in_failed_queue, new_item_data) end |