为什么Rails报告缓存未命中?

时间:2012-09-09 19:58:50

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

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

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说谎?

0 个答案:

没有答案