Mike Slinn
Mike Slinn

Cleaning the Heroku Cache

Published 2013-03-18.

This article is categorized under Heroku

In an earlier post, I talked about using a bash console to experiment with a Heroku app. I mentioned that you should not run sbt. Of course, that is exactly what I did, and I discovered the hard way that the cache can't be cleared from the Heroku bash shell. The build cache is held outside the dyno and cannot be accessed from inside a running dyno.

Cleaning the cache is accomplished with a special cache cleaner buildpack. Set the buildpack in your app like this:

heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-scala.git#cleancache --app myapp

Push your code:

$ git push heroku master

Remove the cache cleaner buildpack:

$ heroku config:remove BUILDPACK_URL --app myapp

Change a file, commit and push again:

$ git push heroku master

All better!