Skip to content

Instantly share code, notes, and snippets.

@nesquena
Created July 27, 2009 09:11
Show Gist options
  • Save nesquena/156120 to your computer and use it in GitHub Desktop.
Save nesquena/156120 to your computer and use it in GitHub Desktop.
# For rails, running memcache in development mode
# check if memcached is running; if it is, enable caching
# To start use $ memcached -m 64 -l 127.0.0.1 -p 11211 -vv -u root
begin
Timeout.timeout(0.5) { TCPSocket.open("localhost", 11211) { } }
config.action_controller.perform_caching = true
config.cache_store = :mem_cache_store, "localhost:11211", { :namespace => "quub" }
rescue StandardError
config.action_controller.perform_caching = false
config.cache_store = :file_store, "#{Rails.root}/tmp/cache"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment