What is the best way to automatically clear Memcached when I deploy my rails app to Heroku?
I\'m caching the home page, and when I make changes and redeploy, the pag
Since the heroku gem is deprecated, an updated version of Solomons very elegant answer would be to save the following code in lib/tasks/heroku_deploy.rake
:
namespace :deploy do
task :production do
puts "deploying to production"
system "git push heroku"
puts "clearing cache"
system "heroku run rake cache:clear"
puts "done"
end
end
namespace :cache do
desc "Clears Rails cache"
task :clear => :environment do
Rails.cache.clear
end
end
then instead of git push heroku master
you type rake deploy:production
in command line.
To just clear the cache you can run rake cache:clear