我用Capistrano的我的应用程序部署到使用内存缓存的机器。我想Capistrano的清除内存缓存,当它部署在网站的一个新版本。

有帮助吗?

解决方案

看看这个GIST解决了这个问题: https://gist.github.com/matthuhiggins / 668744

其他提示

不知道Capistrano的,但你不能杀了memcached的过程,并催生一个新的? 更好可能是也除去碎片。

这由苏珊·波特看起来相当不错 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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top