提交 525d7c30 编写于 作者: Y Yves Senn

Merge pull request #11435 from kennyj/move_to_query_cache

Move initializing process for @query_cache to QueryCache module.
...@@ -20,6 +20,12 @@ def #{method_name}(*) # def update_with_query_dirty(*) ...@@ -20,6 +20,12 @@ def #{method_name}(*) # def update_with_query_dirty(*)
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
......
...@@ -95,8 +95,6 @@ def initialize(connection, logger = nil, pool = nil) #:nodoc: ...@@ -95,8 +95,6 @@ def initialize(connection, logger = nil, pool = nil) #:nodoc:
@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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册