1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Move initializing process for query cache to ActiveRecord::ConnectionAdapters::QueryCache module.

This commit is contained in:
kennyj 2013-07-14 23:19:01 +09:00
parent 41bd94b7ef
commit e8c387e834
2 changed files with 6 additions and 2 deletions

View file

@ -20,6 +20,12 @@ module ActiveRecord
attr_reader :query_cache, :query_cache_enabled attr_reader :query_cache, :query_cache_enabled
def initialize(*)
super
@query_cache = Hash.new { |h,sql| h[sql] = {} }
@query_cache_enabled = false
end
# Enable the query cache within the block. # Enable the query cache within the block.
def cache def cache
old, @query_cache_enabled = @query_cache_enabled, true old, @query_cache_enabled = @query_cache_enabled, true

View file

@ -95,8 +95,6 @@ module ActiveRecord
@last_use = false @last_use = false
@logger = logger @logger = logger
@pool = pool @pool = pool
@query_cache = Hash.new { |h,sql| h[sql] = {} }
@query_cache_enabled = false
@schema_cache = SchemaCache.new self @schema_cache = SchemaCache.new self
@visitor = nil @visitor = nil
end end