1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

This commit is contained in:
Joshua Peek 2008-10-30 15:48:03 -05:00
parent 2092687bcb
commit 0c84b6f9ed

View file

@ -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