我在/ public中有一些原始的.html文件,在我编辑和部署之后仍然被缓存。目标不是要求客户在文件发生变化时(通常)清除缓存。
我的production.rb包含:
# Use a different cache store in production
# pks: recommended by heroku
config.cache_store = :dalli_store
# For Rack::Cache on heroku
# Modify your config/environments/production.rb environment file to specify
# the appropriate storage backends for Rails’ built-in Rack::Cache integration.
config.action_dispatch.rack_cache = {
:metastore => Dalli::Client.new,
:entitystore => 'file:tmp/cache/rack/body',
:allow_reload => false
}
# To allow your application to properly serve, invalidate and refresh static assets
config.serve_static_assets = true
config.static_cache_control = "public, max-age=0" # 2592000" # max-age=0 to to force revalidate
config.assets.digest = true
config.action_controller.perform_caching = true
谢谢!
答案 0 :(得分:0)
我认为您可以创建一个脚本,只要您想部署该脚本,就会调用您用于部署的任何命令,然后使用以下帖子中列出的命令(How can I clear rails cache after deploy to heroku?)