Skip to content
Browse files

Merge pull request #11435 from kennyj/move_to_query_cache

Move initializing process for @query_cache to QueryCache module.
  • Loading branch information...
2 parents cb1d07e + e8c387e commit 525d7c30d01563d705fde589434b41b0f03bca53 @senny senny committed Jul 16, 2013
View
6 activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
@@ -20,6 +20,12 @@ def #{method_name}(*) # def update_with_query_dirty(*)
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
View
2 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -95,8 +95,6 @@ def initialize(connection, logger = nil, pool = nil) #:nodoc:
@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

0 comments on commit 525d7c3

Please sign in to comment.
Something went wrong with that request. Please try again.