Module: ResqueDuplicateless::Ext::Resque::DataStore::QueueAccess
- Included in:
- Resque::DataStore::QueueAccess
- Defined in:
- lib/resque-duplicateless/ext/resque/data_store.rb
Overview
This is the extension for the QueueAccess Object
Instance Method Summary collapse
-
#uniquely_push_to_queue(queue, item) ⇒ Object
This function calls our LUA script for evaluation.
Instance Method Details
#uniquely_push_to_queue(queue, item) ⇒ Object
This function calls our LUA script for evaluation.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/resque-duplicateless/ext/resque/data_store.rb', line 19 def uniquely_push_to_queue(queue, item) out = nil # Ensure the script is loaded @redis.redis.script(:load, uniquely_push_to_queue_script) unless @redis.redis.script(:exists, uniquely_push_to_queue_script_sha) # Now pipeline the watch and addition calls @redis.pipelined do watch_queue queue out = @redis.evalsha uniquely_push_to_queue_script_sha, [redis_key_for_queue_also(queue)], [item] end out.value end |