aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2013-07-14 23:19:01 +0900
committerkennyj <kennyj@gmail.com>2013-07-16 20:49:48 +0900
commite8c387e834d76710e79bc759025d5ae843ba2c31 (patch)
treeb369dd36a13cd8cf87124c36b0d6a21913c9c9be
parent41bd94b7ef0db484268b8c81de528aedad5ae08d (diff)
downloadrails-e8c387e834d76710e79bc759025d5ae843ba2c31.tar.gz
rails-e8c387e834d76710e79bc759025d5ae843ba2c31.tar.bz2
rails-e8c387e834d76710e79bc759025d5ae843ba2c31.zip
Move initializing process for query cache to ActiveRecord::ConnectionAdapters::QueryCache module.
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb6
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_adapter.rb2
2 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
index 41e07fbda9..e6b3c8ec9f 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
@@ -20,6 +20,12 @@ module ActiveRecord
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.
def cache
old, @query_cache_enabled = @query_cache_enabled, true
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index 75333765aa..b82d0fb872 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -95,8 +95,6 @@ module ActiveRecord
@last_use = false
@logger = logger
@pool = pool
- @query_cache = Hash.new { |h,sql| h[sql] = {} }
- @query_cache_enabled = false
@schema_cache = SchemaCache.new self
@visitor = nil
end