edge badge

Active Record Query Cache

Namespace
Methods
C
I
R
Class Public methods
complete((connection, enabled))
# File activerecord/lib/active_record/query_cache.rb, line 34
def self.complete((connection, enabled))
  connection.clear_query_cache
  connection.disable_query_cache! unless enabled

  unless ActiveRecord::Base.connected? && ActiveRecord::Base.connection.transaction_open?
    ActiveRecord::Base.clear_active_connections!
  end
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)
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.enable_query_cache!

  [connection, enabled]
end