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?
clear in the Rails console to clear the cache. Unfortunately there is no way (yet) to do it from the command line. We can add a rake task that will do this for us. Then we can execute ./bin/rake cache:clear and clear the Rails cache from the command line.
By default, the page cache directory is set to Rails. public_path (which is usually set to the public folder) and this can be configured by changing the configuration setting config. action_controller. page_cache_directory.
In order to use page and action caching you will need to add actionpack-page_caching and actionpack-action_caching to your Gemfile . By default, caching is only enabled in your production environment. You can play around with caching locally by running rails dev:cache , or by setting config. action_controller.
Ruby on Rails Caching Russian Doll Caching You may want to nest cached fragments inside other cached fragments. This is called Russian doll caching . The advantage of Russian doll caching is that if a single product is updated, all the other inner fragments can be reused when regenerating the outer fragment.
I ended up manually clearing the entire cache by going into the rails console and using the command:
Rails.cache.clear
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With