Class: Sidekiq::Middlewares::DisableArCache

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/middlewares/disable_ar_cache.rb

Overview

skip cache ActiveRecord if disable_ar_cache option is true example usage:

sidekiq_options disable_ar_cache: true

Instance Method Summary collapse

Instance Method Details

#call(_job_instance, options, _queue, &block) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/sidekiq/middlewares/disable_ar_cache.rb', line 7

def call(_job_instance, options, _queue, &block)
  if options['disable_ar_cache']
    ActiveRecord::Base.uncached(&block)
  else
    yield
  end
end