Class: CacheWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
app/workers/cache_worker.rb

Instance Method Summary collapse

Instance Method Details

#perform(options = {}) ⇒ Object

options:
cache_class: name of a class fully qualified to instantiate
params: passed to the class



9
10
11
12
13
14
15
16
17
18
# File 'app/workers/cache_worker.rb', line 9

def perform(options = {})
  options = options.with_indifferent_access
  logger.debug(" ** Cache Worker execution starting", cache_class: options[:cache_class])
  raise 'Cache worker, missing cache_class parameter' unless options.present? && options[:cache_class].present?

  cache_class_name = options[:cache_class]
  service = cache_class_name.constantize.new
  res = service.process(options[:params])
  logger.info " ** #{cache_class_name} completed. result: #{res}"
end