diff options
author | kennyj <kennyj@gmail.com> | 2013-07-14 23:19:01 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2013-07-16 20:49:48 +0900 |
commit | e8c387e834d76710e79bc759025d5ae843ba2c31 (patch) | |
tree | b369dd36a13cd8cf87124c36b0d6a21913c9c9be /activerecord | |
parent | 41bd94b7ef0db484268b8c81de528aedad5ae08d (diff) | |
download | rails-e8c387e834d76710e79bc759025d5ae843ba2c31.tar.gz rails-e8c387e834d76710e79bc759025d5ae843ba2c31.tar.bz2 rails-e8c387e834d76710e79bc759025d5ae843ba2c31.zip |
Move initializing process for query cache to ActiveRecord::ConnectionAdapters::QueryCache module.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb | 6 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 2 |
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 |