Rails Caching Note : expiring cache when running your app with multiple slices
- December 9th, 2008
- Write comment
Note to self :
If you’re using fragment caching and you’re application is deployed to a hosting provider with multiple slices. don’t forget to define the location of the cache and store your cache in a location that all slices have access to. by default rails stores the cache in /tmp/cache , normally I would point it to RAILS_ROOT + tmp/cache
Here’s how to explicitly define the location of your cache:
Just need to define this in your environment.rb or create a file in the initializers directory.
ActionController::Base.fragment_cache_store = :file_store, "/path/to/cache/directory"
Some links about caching that I find very useful:
http://www.railsenvy.com/2007/2/28/rails-caching-tutorial
http://www.railsenvy.com/2007/3/20/ruby-on-rails-caching-tutorial-part-2