Heroku Rails:部署时/public/*.html的缓存无效?

时间:2013-10-17 19:48:07

标签: ruby-on-rails caching heroku static http-headers

我在/ 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    

HTTP Headers for static html asset

谢谢!

1 个答案:

答案 0 :(得分:0)

我认为您可以创建一个脚本,只要您想部署该脚本,就会调用您用于部署的任何命令,然后使用以下帖子中列出的命令(How can I clear rails cache after deploy to heroku?