views:

99

answers:

2

I am pretty sure it does, but I wanted to double check, since I don't know exactly how Passenger restarts a rails app. So if I have something like:

Rails.cache.fetch(:my_obj) { MyObj.first }

will all the cache be cleared upon restart (which is my hope)?

A: 

If you are using MemoryStore then yes, this cache will disappear when Passenger restarts.

Also, a quote from the API:

If you’re running multiple Ruby on Rails server processes (which is the case if you’re using mongrel_cluster or Phusion Passenger), then this means that your Rails server process instances won’t be able to share cache data with each other.

Drew Blas
thanks..thats what I figured, just wanted to double check
gmoniey
A: 

You can use memcached to get rid of this issue. With memcached you should be able to use your cached data even after you restart your app server. However, if you restart memcached, the data will need to be cached again.

Sohan
He actually WANTS the cache to clear when he restarts, so memcached would not be good (although you can easily clear memcached manually if needed)
Drew Blas