0

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

静态 html 资产的 HTTP 标头

谢谢!

4

1 回答 1

0

我认为您也许可以创建一个脚本,在您想要部署时运行该脚本,该脚本调用您用于部署的任何命令,然后使用以下帖子中列出的命令(部署到 heroku 后如何清除 rails 缓存?

于 2013-10-17T20:07:04.543 回答