Active Record Query Cache

Namespace
Methods
C
I
R
Class Public methods
complete(state)
# File activerecord/lib/active_record/query_cache.rb, line 35
def self.complete(state)
  enabled, connection_id = state

  ActiveRecord::Base.connection_id = connection_id
  ActiveRecord::Base.connection.clear_query_cache
  ActiveRecord::Base.connection.disable_query_cache! unless enabled
end
install_executor_hooks(executor = ActiveSupport::Executor)
# File activerecord/lib/active_record/query_cache.rb, line 43
def self.install_executor_hooks(executor = ActiveSupport::Executor)
  executor.register_hook(self)

  executor.to_complete do
    unless ActiveRecord::Base.connection.transaction_open?
      ActiveRecord::Base.clear_active_connections!
    end
  end
end
run()
# File activerecord/lib/active_record/query_cache.rb, line 26
def self.run
  connection    = ActiveRecord::Base.connection
  enabled       = connection.query_cache_enabled
  connection_id = ActiveRecord::Base.connection_id
  connection.enable_query_cache!

  [enabled, connection_id]
end