123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord::QueryCache::ExecutorHooks

Do not use. This module is for internal use only.
Relationships & Source Files
Defined in: activerecord/lib/active_record/query_cache.rb

Class Method Summary

Class Method Details

.complete(previous, already_enabled)

[ GitHub ]

  
# File 'activerecord/lib/active_record/query_cache.rb', line 66

def self.complete((previous, already_enabled))
  ConnectionAdapters::QueryCache.enabled_by_default = previous

  ConnectionAdapters::ConnectionPool.each_used_pool do |pool|
    pool.reset_query_cache! unless already_enabled&.include?(pool.query_cache)
  end
end

.run

[ GitHub ]

  
# File 'activerecord/lib/active_record/query_cache.rb', line 49

def self.run
  previous = ConnectionAdapters::QueryCache.enabled_by_default
  ConnectionAdapters::QueryCache.enabled_by_default = true

  already_enabled = nil
  ConnectionAdapters::ConnectionPool.each_used_pool do |pool|
    cache = pool.query_cache
    if cache.enabled
      (already_enabled ||= []) << cache
    else
      pool.prepare_query_cache(cache)
    end
  end

  [previous, already_enabled]
end