Class: ActiveRecord::QueryCache
- Inherits:
-
Object
- Object
- ActiveRecord::QueryCache
show all
- Defined in:
- lib/active_record/query_cache.rb
Overview
Active Record Query Cache
Defined Under Namespace
Modules: ClassMethods
Class Method Summary
collapse
Class Method Details
.complete(state) ⇒ Object
.install_executor_hooks(executor = ActiveSupport::Executor) ⇒ Object
43
44
45
46
47
48
49
50
51
|
# 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 ⇒ Object
26
27
28
29
30
31
32
33
|
# 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
|