aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-10-30 15:48:03 -0500
committerJoshua Peek <josh@joshpeek.com>2008-10-30 15:48:03 -0500
commit0c84b6f9eda20c30b66d8fb99fba637edc1bc37a (patch)
tree32c81681dccb650e6aa9fa4d7fa82845f71c3bb7 /activerecord
parent2092687bcb35a3d30e1d05d3f5f461d8f4e8f9b7 (diff)
downloadrails-0c84b6f9eda20c30b66d8fb99fba637edc1bc37a.tar.gz
rails-0c84b6f9eda20c30b66d8fb99fba637edc1bc37a.tar.bz2
rails-0c84b6f9eda20c30b66d8fb99fba637edc1bc37a.zip
Use database name in query cache thread local key [#1283 state:resolved]
Diffstat (limited to 'activerecord')
-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