class ActiveRecord::QueryCache
Active Record Query Cache¶ ↑
Public Class Methods
complete(state)
click to toggle source
# File 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)
click to toggle source
# File 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()
click to toggle source
# File 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