提交 0c84b6f9 编写于 作者: J Joshua Peek

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

上级 2092687b
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册