aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2008-05-07 16:04:58 +0200
committerXavier Noria <fxn@hashref.com>2008-05-07 16:04:58 +0200
commitacf520457462d3987adbf540625c59e355e4d974 (patch)
tree6a5d14270d47fde433fc81015a1161ea10efe3d4 /activerecord
parent408d5fd5805d0264d8ce5c45be40a984364626f9 (diff)
downloadrails-acf520457462d3987adbf540625c59e355e4d974.tar.gz
rails-acf520457462d3987adbf540625c59e355e4d974.tar.bz2
rails-acf520457462d3987adbf540625c59e355e4d974.zip
applies patch in http://rails.lighthouseapp.com/projects/8994/tickets/132-document-clear_query_cache
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb6
1 files changed, 6 insertions, 0 deletions
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