Posts

Expiring Cache Fragments from the console 29 Jun 2011
Tags: console, cache

I've been using some simple fragment caching on some of the pages of my current app.  But one update made all these fragments expire.  So either I create a rake task to delete these cache fragments or I use the console. Either way, the only thing you need to remember is

ruby
ActionController::Base.new.expire_fragment(key)

Of course, almost all of the times, key is dynamic. But since key accepts either a String, Hash or Regexp, this shouldn't be a problem. Check the fragment caching module