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 2fc50b9..8543bbf 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb @@ -34,17 +34,16 @@ module ActiveRecord end def query_cache - Thread.current['query_cache'] + Thread.current["query_cache_for_#{@config[:database]}"] ||= {} end def query_cache=(cache) - Thread.current['query_cache'] = cache + Thread.current["query_cache_for_#{@config[:database]}"] = cache end # Enable the query cache within the block. def cache old, self.query_cache_enabled = query_cache_enabled, true - self.query_cache ||= {} yield ensure clear_query_cache