From 0c84b6f9eda20c30b66d8fb99fba637edc1bc37a Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Thu, 30 Oct 2008 15:48:03 -0500 Subject: Use database name in query cache thread local key [#1283 state:resolved] --- .../lib/active_record/connection_adapters/abstract/query_cache.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'activerecord') 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 2fc50b9bfa..8543bbf872 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 -- cgit v1.2.3