Welcome Guest | Login

Fragment Cache Location

I have tracked down two other threads to try and figure out where the fragments are caching:http://www.hostingrails.com/forums/rails_coding_thread/385http://www.hostingrails.com/forums/rails_coding_thread/588

And they both mention the same basic options. I have added:
ActionController::Base.fragment_cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"

To my production.rb file and changed my deploy.rb chmod755 to:

set :chmod755, "app config db lib public vendor script script/* public/disp* tmp/cache"

Based on the page load speed I suspect caching is working but I have no idea where the files are. The fragments are also not expiring which is the real issue.

2008-02-26 11:28 PM

I see the Fragment cache created files under your ~app/tmp/sessions

To expire Fragment cache you may use something like given below.

===========
# Expire the blog list fragment
expire_fragment(:controller => 'controller name', :action => 'your custom action')
===========

2008-02-27 06:19 AM

Interesting, I'm using this type of code to expire the fragments and it works perfectly in development.

I specified:
ActionController::Base.fragment_cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"

as the cache store and I bet that's where Rails is trying to remove the fragments from. Why are the going somewhere else?

Should I change the cache store to '~app/tmp/sessions'?

2008-02-27 12:32 PM

Try to get this working outside of cap first.  Can you restart your mongrel(s)/fastcgi and see if anything is written to #{RAILS_ROOT}/tmp/cache


And yes, try playing around with the locayion of the cache store until you're able to get those files predictably somewhere.  

Also, your comment:

"Based on the page load speed I suspect caching is working "

do you have log data to prove this? Both FastCGI and mongrel are quite fast.

2008-02-27 02:42 PM

Restarting manually got caching going. The fragments are being stored in  #{RAILS_ROOT}/tmp/cache/my.ip.address. Is this a normal behavior?

They do not appear to be expiring properly.

2008-03-01 06:13 PM

What do you mean "They do not appear to be expiring properly." -- how are you trying to expire them, exactly?  Do they expire after a server reload?

2008-03-01 11:07 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.