From acf520457462d3987adbf540625c59e355e4d974 Mon Sep 17 00:00:00 2001 From: Xavier Noria <fxn@hashref.com> Date: Wed, 7 May 2008 16:04:58 +0200 Subject: applies patch in http://rails.lighthouseapp.com/projects/8994/tickets/132-document-clear_query_cache --- .../lib/active_record/connection_adapters/abstract/query_cache.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb index e6b8e3ae90..2afd6064ad 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb @@ -44,6 +44,12 @@ module ActiveRecord @query_cache_enabled = old end + # Clears the query cache. + # + # One reason you may wish to call this method explicitly is between queries + # that ask the database to randomize results. Otherwise the cache would see + # the same SQL query and repeatedly return the same result each time, silently + # undermining the randomness you were expecting. def clear_query_cache @query_cache.clear if @query_cache end -- cgit v1.2.3