Module: Qs::Client::InstanceMethods
- Defined in:
- lib/qs/client.rb
Instance Attribute Summary collapse
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
-
#redis_config ⇒ Object
readonly
Returns the value of attribute redis_config.
Instance Method Summary collapse
- #append(queue_redis_key, serialized_payload) ⇒ Object
- #block_dequeue(*args) ⇒ Object
- #clear(redis_key) ⇒ Object
- #enqueue(queue, job_name, params = nil) ⇒ Object
- #initialize(redis_config) ⇒ Object
- #ping ⇒ Object
- #prepend(queue_redis_key, serialized_payload) ⇒ Object
- #push(queue_name, payload) ⇒ Object
Instance Attribute Details
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
26 27 28 |
# File 'lib/qs/client.rb', line 26 def redis @redis end |
#redis_config ⇒ Object (readonly)
Returns the value of attribute redis_config.
26 27 28 |
# File 'lib/qs/client.rb', line 26 def redis_config @redis_config end |
Instance Method Details
#append(queue_redis_key, serialized_payload) ⇒ Object
46 47 48 |
# File 'lib/qs/client.rb', line 46 def append(queue_redis_key, serialized_payload) self.redis.with{ |c| c.lpush(queue_redis_key, serialized_payload) } end |
#block_dequeue(*args) ⇒ Object
42 43 44 |
# File 'lib/qs/client.rb', line 42 def block_dequeue(*args) self.redis.with{ |c| c.brpop(*args) } end |
#clear(redis_key) ⇒ Object
54 55 56 |
# File 'lib/qs/client.rb', line 54 def clear(redis_key) self.redis.with{ |c| c.del(redis_key) } end |
#enqueue(queue, job_name, params = nil) ⇒ Object
32 33 34 35 36 |
# File 'lib/qs/client.rb', line 32 def enqueue(queue, job_name, params = nil) job = Qs::Job.new(job_name, params || {}) enqueue!(queue, job) job end |
#initialize(redis_config) ⇒ Object
28 29 30 |
# File 'lib/qs/client.rb', line 28 def initialize(redis_config) @redis_config = redis_config end |
#ping ⇒ Object
58 59 60 |
# File 'lib/qs/client.rb', line 58 def ping self.redis.with{ |c| c.ping } end |
#prepend(queue_redis_key, serialized_payload) ⇒ Object
50 51 52 |
# File 'lib/qs/client.rb', line 50 def prepend(queue_redis_key, serialized_payload) self.redis.with{ |c| c.rpush(queue_redis_key, serialized_payload) } end |
#push(queue_name, payload) ⇒ Object
38 39 40 |
# File 'lib/qs/client.rb', line 38 def push(queue_name, payload) raise NotImplementedError end |