Class: CacheJSON::Worker
- Inherits:
-
Object
- Object
- CacheJSON::Worker
- Includes:
- Sidekiq::Worker
- Defined in:
- lib/cache_json/worker.rb
Defined Under Namespace
Classes: AllPermutations
Instance Method Summary collapse
Instance Method Details
#perform(klass: nil, args: {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cache_json/worker.rb', line 21 def perform(klass: nil, args: {}) if klass klass.new.refresh_cache!(args: args) else AllPermutations.new.results.each do |perm| if should_refresh?(perm[:klass], perm[:args]) CacheJSON::Worker.new.perform(klass: perm[:klass], args: perm[:args]) end end end end |
#perform_async ⇒ Object
15 16 17 18 |
# File 'lib/cache_json/worker.rb', line 15 def perform_async(*) raise 'Sidekiq gem not found. ' \ 'You can still call this worker manually via CacheJSON::Worker.new.perform' end |