Method: Resque#push
- Defined in:
- lib/resque.rb
#push(queue, item) ⇒ Object
Pushes a job onto a queue. Queue name should be a string and the item should be any JSON-able Ruby object.
Resque works generally expect the item to be a hash with the following keys:
class - The String name of the job to run.
args - An Array of arguments to pass the job. Usually passed
via `class.to_class.perform(*args)`.
Example
Resque.push('archive', :class => 'Archive', :args => [ 35, 'tar' ])
Returns nothing
149 150 151 152 |
# File 'lib/resque.rb', line 149 def push(queue, item) watch_queue(queue) redis.rpush "queue:#{queue}", encode(item) end |