I use capistrano to deploy my app to a machine that uses memcache. I want capistrano to clear memcache when it deploys a new version of the site.
4 Answers
-
I found that I couldn't start memcached using the Capistrano recipe you linked to. Then I found this: ruby-forum.com/topic/83485. That worked for me.– mj1531Dec 14, 2011 at 23:15
Take a look at this GIST solves the problem: https://gist.github.com/matthuhiggins/668744
-
-
Maybe the blog was ended. I'll get it on webarchive and post on gist or something similar. Feb 15, 2018 at 13:11
Don't know capistrano, but can't you just kill the memcached process and spawn a new one? Better probably for removing fragmentation also.
-
capistrano is deployment automation tool, so that restart would also be done by capistrano.– vartecMar 13, 2009 at 16:33
This, by Susan Potter looks pretty good 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