I applied cache to my heroku rails app and it works well. But everytime I deploy to heroku, I also want to clear cache automatically.
so I googled and I found this
If you want to simply run a rake task after deploy, I would recommend checking out:
https://github.com/gunpowderlabs/buildpack-ruby-rake-deploy-tasks
We've been using it in production for over 6 months and it's been rock solid.
First, add the buildpack AFTER you already have the Ruby buildpack set. This should happen after your first deploy to the server
heroku buildpacks:add https://github.com/gunpowderlabs/buildpack-ruby-rake-deploy-tasks
Second, set an environment variable called DEPLOY_TASKS
with just the names of the rake tasks you want to run separated by spaces.
heroku config:set DEPLOY_TASKS='cache:clear