How can I clear rails cache after deploy to heroku?

前端 未结 7 2009
暖寄归人
暖寄归人 2020-12-13 13:21

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

7条回答
  •  北海茫月
    2020-12-13 13:55

    The following should work on cedar:

    heroku run console
    

    ..then wait 5 seconds for heroku console to boot

    Rails.cache.clear
    

    Then you should see the cache clear, and you can quit console. Remember you might have to refresh a few times because your local machine will often cache assets and such in your browser until it makes a fresh request.

    If it happens to be assets that you're caching though, you don't need to go through a manual clear every time you push, you just need to have the asset pipeline set up and make sure all your js/css(less/sass)/static images are being compiled with hashes at the end of their filenames.

提交回复
热议问题