module ActiveRecord::ConnectionAdapters::QueryCache::ConnectionPoolConfiguration

def checkout_and_verify(connection)

def checkout_and_verify(connection)
  super
  connection.query_cache ||= query_cache
  connection
end

def clear_query_cache

def clear_query_cache
  if @pinned_connection
    # With transactional fixtures, and especially systems test
    # another thread may use the same connection, but with a different
    # query cache. So we must clear them all.
    @query_cache_version.increment
  end
  query_cache.clear
end

def dirties_query_cache

def dirties_query_cache
  query_cache.dirties
end

def disable_query_cache(dirties: true)

Disable the query cache within the block.
def disable_query_cache(dirties: true)
  cache = query_cache
  old_enabled, cache.enabled, old_dirties, cache.dirties = cache.enabled, false, cache.dirties, dirties
  begin
    yield
  ensure
    cache.enabled, cache.dirties = old_enabled, old_dirties
  end
end

def disable_query_cache!

def disable_query_cache!
  query_cache.enabled = false
  query_cache.dirties = true
end

def enable_query_cache

def enable_query_cache
  cache = query_cache
  old_enabled, cache.enabled, old_dirties, cache.dirties = cache.enabled, true, cache.dirties, true
  begin
    yield
  ensure
    cache.enabled, cache.dirties = old_enabled, old_dirties
  end
end

def enable_query_cache!

def enable_query_cache!
  query_cache.enabled = true
  query_cache.dirties = true
end

def initialize(...)

:nodoc:
def initialize(...)
  super
  @query_cache_version = Concurrent::AtomicFixnum.new
  @thread_query_caches = QueryCacheRegistry.new
  @query_cache_max_size = \
    case query_cache = db_config&.query_cache
    when 0, false
      nil
    when Integer
      query_cache
    when nil
      DEFAULT_SIZE
    end
end

def query_cache

def query_cache
  @thread_query_caches.compute_if_absent(ActiveSupport::IsolatedExecutionState.context) do
    Store.new(@query_cache_version, @query_cache_max_size)
  end
end

def query_cache_enabled

def query_cache_enabled
  query_cache.enabled
end