Search code examples
rubyactiverecordcaching

Clearing ActiveRecord cache


I'm building a command line application using ActiveRecord 3.0 (without rails). How do I clear the query cache that ActiveRecord maintains?


Solution

  • To a first approximation:

    ActiveRecord::Base.connection.query_cache.clear