How do I reconnect to Memcache when forking in rails?
I have a rails 3 application, and a script called by rails runner
. This script forks and does some stuff in other processes. I do the proper thing with ActiveRecord before forking, where I disconnect-fork-reconnect and all that jazz.
My question is I 开发者_C百科also use memcache for the Rails.cache
but should I be disconnecting-reconnecting that too for my forks? If so, how would I go about that in the rails way.
Yes, you should reconnect memcache after the fork. You can see a discussion related to this at the mod_rails documentation.
You can trigger memcache to reconnect
Rails.cache.reset
精彩评论