aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb5
1 files changed, 2 insertions, 3 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 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