module Resque::Plugins::QueryCache

Constants

VERSION

Public Instance Methods

around_perform_query_cache(*args) { || ... } click to toggle source
# File lib/resque/plugins/query_cache.rb, line 6
def around_perform_query_cache(*args)
  query_cache_enabled = ActiveRecord::Base.connection.query_cache_enabled
  connection_id = ActiveRecord::Base.connection_id
  ActiveRecord::Base.connection.enable_query_cache!

  yield if block_given?
ensure
  ActiveRecord::Base.connection_id = connection_id
  ActiveRecord::Base.connection.clear_query_cache
  ActiveRecord::Base.connection.disable_query_cache! unless query_cache_enabled
end