Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use database name in query cache thread local key [#1283 state:resolved]

  • Loading branch information...
commit 0c84b6f9eda20c30b66d8fb99fba637edc1bc37a 1 parent 2092687
@josh josh authored
View
5 activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
@@ -34,17 +34,16 @@ def query_cache_enabled=(flag)
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

0 comments on commit 0c84b6f

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