module ResqueJob

Public Instance Methods

result_key() click to toggle source
# File lib/resque_job.rb, line 69
def result_key
  @result_key ||= self.class.result_key(job_id)
end
store_initial_result(res, options = {}) click to toggle source
# File lib/resque_job.rb, line 73
def store_initial_result(res, options = {})
  key = self.class.result_key(options[:initial_job_id].presence || job_id)
  Resque.redis.set(key, res.to_json, ex: 1.hour.to_i)
end
store_result(res, options = {}) click to toggle source
# File lib/resque_job.rb, line 78
def store_result(res, options = {})
  key = if (jid = options[:initial_job_id]).blank?
          result_key
        else
          # store result with parent job id to retrieve the result later knowing only parent job id
          [Resque.redis.namespace, 'result', self.class.name.underscore, jid, job_id].join(':')
        end
  Resque.redis.set(key, res.to_json, ex: 1.hour.to_i)
end