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:
parent
2092687bcb
commit
0c84b6f9ed
1 changed files with 2 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue