我的一些资产只是在Rails开发环境中缓存的浏览器

时间:2012-03-25 13:43:39

标签: ruby-on-rails asset-pipeline

我正在运行rails 3.2。我正在尝试在开发模式下尽快让页面刷新,所以我为我的资产设置了以下配置:

  config.static_cache_control = "public, max-age=3600"
  config.assets.debug = false
  config.assets.digest = true

我们的想法是让所有资产都使用摘要并进行浏览器缓存。我所看到的是,我的部分资产只能正确缓存:

cache: [GET /assets/homepage/post-f7a1b20c625428032e3acf51388c8a6c.png] fresh
cache: [GET /assets/general/posted_check-0cf4eac99c06719e1ddf56a091550e80.png] fresh
cache: [GET /assets/general/about_footer.png] stale, valid, store
cache: [GET /assets/general/social_footer.png] stale, valid, store

最后两个是获取Cache-Control:从服务器返回无缓存,我无法弄清楚原因。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

设置config.assets.digest = true后,我必须清除Sprockets资产缓存。删除tmp / cache / assets修复了它。