diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-07-16 04:54:48 -0700 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-07-16 04:54:48 -0700 |
commit | 525d7c30d01563d705fde589434b41b0f03bca53 (patch) | |
tree | b369dd36a13cd8cf87124c36b0d6a21913c9c9be /activerecord/lib | |
parent | cb1d07e43926bcec95cb8b4a663ca9889173395a (diff) | |
parent | e8c387e834d76710e79bc759025d5ae843ba2c31 (diff) | |
download | rails-525d7c30d01563d705fde589434b41b0f03bca53.tar.gz rails-525d7c30d01563d705fde589434b41b0f03bca53.tar.bz2 rails-525d7c30d01563d705fde589434b41b0f03bca53.zip |
Merge pull request #11435 from kennyj/move_to_query_cache
Move initializing process for @query_cache to QueryCache module.
Diffstat (limited to 'activerecord/lib')
-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 |