Rails page fragment caching
Posted by lori, Thu Jan 22 22:08:00 UTC 2009
Our Rails application is very dynamic, so page and action caching are not really suitable. But page fragment caching is quite useful. I was implementing this yesterday, and using Greg and Ryan's very useful little tutorial, when I ran into a little difficulty...Where the heck are the cached fragments?
It was puzzling, but I just couldn't find them, and I was going nuts searching. I thought maybe Passenger was overriding the default location, and stashing them somewhere under Apache. Nope.
Turns out, the answer is fairly simple. The tutorial was written some time ago, and since then the default cache store has changed from :file_store to :memory_store. So you can look for the cache files forever, but you ain't gonna find them.
So, if you want to see caching files in your development environment, you need to have these lines in your config/environments/development.rb file:
config.action_controller.perform_caching = true
config.action_controller.cache_store = :file_store, RAILS_ROOT+"/tmp/cache/"



