【发布时间】:2012-08-15 05:14:17
【问题描述】:
我将缓存应用于我的 heroku rails 应用程序,它运行良好。 但是每次我部署到heroku,我也想自动清除缓存。
所以我用谷歌搜索并找到了这个。
task :after_deploy, :env, :branch do |t, args|
puts "Deployment Complete"
puts "Cleaning all cache...."
FileUtils.cd Rails.root do
sh %{heroku run console}
sh %{Rails.cache.clear}
end
end
但是当我查看这个脚本时,它只显示了 heroku 控制台命令行,但没有输入 Rails.cache.clear 命令。 (我猜那是因为 heroku 控制台是交互式的)
和
system "heroku console Rails.cache.clear"
不适用于 cedar 应用。
我该如何解决这个问题?
谢谢。
【问题讨论】:
标签: ruby-on-rails heroku caching deployment