Method: ActiveRecord::ConnectionAdapters::QueryCache#clear_query_cache

Defined in:
lib/active_record/connection_adapters/abstract/query_cache.rb

#clear_query_cacheObject

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.



54
55
56
# File 'lib/active_record/connection_adapters/abstract/query_cache.rb', line 54

def clear_query_cache
  @query_cache.clear if @query_cache
end