Manually Clear Fragment Cache in Rails

caching, memcached, ruby-on-rails-3

Solution

I ended up manually clearing the entire cache by going into the rails console and using the command:

Rails.cache.clear

Problem

I'm using Memcached with Heroku for a Rails 3.1 app. I had a bug and the wrong things are showing - the parameters were incorrect for the cache. I had this: ``` <% cache("foo_header_cache_#{@user.id}") do %> ``` I removed the fragment caching and pushed to Heroku and the bad data went away. And then I changed it to: ``` <% cache("foo_header_cache_#{@foo.id}") do %> ``` However, when I corrected the parameters, from @user to @foo, the old [incorrect] cached version showed again (instead of refreshing with the correct data). How can I manually expire this, or otherwise get rid of this bad data that is showing?

Original source