Module: ActiveRecord::ConnectionAdapters::QueryCache::ConnectionPoolConfiguration

Included in:
ConnectionPool
Defined in:
lib/active_record/connection_adapters/abstract/query_cache.rb

Instance Method Summary collapse

Instance Method Details

#disable_query_cache!Object



39
40
41
42
# File 'lib/active_record/connection_adapters/abstract/query_cache.rb', line 39

def disable_query_cache!
  @query_cache_enabled.delete connection_cache_key(Thread.current)
  connection.disable_query_cache! if active_connection?
end

#enable_query_cache!Object



34
35
36
37
# File 'lib/active_record/connection_adapters/abstract/query_cache.rb', line 34

def enable_query_cache!
  @query_cache_enabled[connection_cache_key(Thread.current)] = true
  connection.enable_query_cache! if active_connection?
end

#initializeObject



29
30
31
32
# File 'lib/active_record/connection_adapters/abstract/query_cache.rb', line 29

def initialize(*)
  super
  @query_cache_enabled = Concurrent::Map.new { false }
end

#query_cache_enabledObject



44
45
46
# File 'lib/active_record/connection_adapters/abstract/query_cache.rb', line 44

def query_cache_enabled
  @query_cache_enabled[connection_cache_key(Thread.current)]
end