Pregunta

Uso capistrano para implementar mi aplicación en una máquina que usa memcache. Quiero que capistrano borre memcache cuando implemente una nueva versión del sitio.

¿Fue útil?

Solución

Eche un vistazo a este GIST resuelve el problema: https://gist.github.com/matthuhiggins / 668744

Otros consejos

No sé capistrano, pero ¿no puedes simplemente matar el proceso memcached y generar uno nuevo? Probablemente mejor para eliminar también la fragmentación.

Esto, por Susan Potter, se ve bastante bien https://gist.github.com/rays/154570

# 2007 Copyright Susan Potter <me at susanpotter dot net>
# You can read her software development rants at: http://geek.susanpotter.net
# Released under CreativeCommons-attribution-noncommercial-sharealike license:
# http://creativecommons.org/licenses/by-nc-sa/1.0/
namespace :memcached do
  desc "Restart the Memcache daemon"
  task :restart, :roles => :app do
    deploy.memcached.stop
    deploy.memcached.start
  end

  desc "Start the Memcache daemon"
  task :start, :roles => :app do
    invoke_command "memcached -P #{current_path}/log/memcached.pid  -d", :via => run_method
  end

  desc "Stop the Memcache daemon"
  task :stop, :roles => :app do
    pid_file = "#{current_path}/log/memcached.pid"
    invoke_command("killall -9 memcached", :via => run_method) if File.exist?(pid_file)
  end
end
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top