Skip to content

Instantly share code, notes, and snippets.

@travisp
Created November 1, 2011 21:14
Show Gist options
  • Save travisp/1331933 to your computer and use it in GitHub Desktop.
Save travisp/1331933 to your computer and use it in GitHub Desktop.
c/environment.rb
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Mokabla::Application.initialize!
if defined?(PhusionPassenger) && !Rails.env.development?
PhusionPassenger.on_event(:starting_worker_process) do |forked|
# Reset Rails's object cache
# Only works with DalliStore
Rails.cache.reset if forked
# Reset Rails's session store
# If you know a cleaner way to find the session store instance, please let me know
ObjectSpace.each_object(ActionDispatch::Session::DalliStore) { |obj| obj.reset }
end
end
~
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment