module ActiveRecord::ConnectionAdapters::QueryCache

def cache

Enable the query cache within the block.
def cache
  old, @query_cache_enabled = @query_cache_enabled, true
  yield
ensure
  @query_cache_enabled = old
  clear_query_cache unless @query_cache_enabled
end