【问题标题】:Why does Rails report a cache miss?为什么 Rails 报告缓存未命中?
【发布时间】:2012-09-09 19:58:49
【问题描述】:

我为我的应用中的某些操作启用了操作缓存。当我在生产模式下运行时(启用缓存,使用内存缓存),我在第一个请求时得到以下输出:

cache: [GET /users/user72] miss
Started GET "/users/user72" for 127.0.0.1 at 2012-09-09 20:46:10 +0100
Processing by UsersController#show as HTML
Parameters: {"username"=>"user72", "user"=>{"username"=>"user72"}}
Read fragment views/localhost:4000/users/user72 (0.0ms)
Write fragment views/localhost:4000/users/user72 (0.0ms)
Rendered text template within layouts/application (0.0ms)
Completed 200 OK in 87ms (Views: 0.2ms | ActiveRecord: 9.7ms)

一切都好。然后在第二个请求上:

cache: [GET /users/user72] miss
Started GET "/users/user72" for 127.0.0.1 at 2012-09-09 20:46:11 +0100
Processing by UsersController#show as HTML
Parameters: {"username"=>"user72", "user"=>{"username"=>"user72"}}    
Read fragment views/localhost:4000/users/user72 (0.0ms)
Rendered text template within layouts/application (0.0ms)
Completed 200 OK in 5ms

看起来第二个请求是从缓存中提供的,正如我所期望的那样,但似乎被报告为缓存未命中。有谁知道为什么?我错了吗,真的是缓存未命中吗?还是 Rails 在说谎?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 caching


    【解决方案1】:

    第一次缓存未命中似乎是页面缓存检查。

    第二个是片段缓存检查,很好。

    【讨论】:

      猜你喜欢
      • 2013-01-18
      • 2013-09-04
      • 2017-10-03
      • 1970-01-01
      • 2019-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多