Skip to content

Instantly share code, notes, and snippets.

@agibralter
Created August 24, 2009 21:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agibralter/174221 to your computer and use it in GitHub Desktop.
Save agibralter/174221 to your computer and use it in GitHub Desktop.
# ...
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
Rails.cache.instance_variable_get(:@data).reset if Rails.cache.class == ActiveSupport::Cache::MemCacheStore
ActionController::Base.session_options[:cache].reset
end
end
end
# ...
@madsheep
Copy link

madsheep commented Mar 2, 2011

I know this is an old one, but any ideas how to do it on RoR3?

@agibralter
Copy link
Author

Hmm I'm not too sure of the specific syntax for Rails 3... but I'm sure the idea is similar.

https://github.com/rails/rails/blob/v3.0.5/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
https://github.com/rails/rails/blob/v3.0.5/activesupport/lib/active_support/cache.rb

As for where to put it... perhaps in an config/initializers?

Sorry... I haven't upgraded to Rails 3 yet...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment