我为我的应用程序中的某些操作启用了操作缓存。当我在生产模式下运行时(启用缓存,使用内存缓存),我在第一个请求时得到以下输出:
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 在说谎?