For a site we have been updating, we needed the action cache expired every so often independent of the sweeper.

Unfortunately, we were having difficulty using the expire_action or expire_fragment call from a rake task.

Many thanks to Aaron Patterson for his help going through the sweeper source code to figure out why it was failing.

The expire_fragment method would fail cache_configured? when running from a rake task even though the cache_store was specified in the environment.

As a work around, the solution was to delete the cache file directly with a regular expression

desc "Clear Index Cache by Rake"
task :clear_index_cache => :environment do
  store = ActionController::Base.cache_store
  store.delete_matched(/index/)
end

With using the Whenever gem, it makes it easy to set the rake task to a schedule.