在我的开发环境中,我有一个生成数百个相同查询的请求:
Person Load (24.4ms) SELECT "persons".* FROM "persons" WHERE ("persons"."person_id" = 517) LIMIT 1
. . .
Person Load (64.4ms) SELECT "persons".* FROM "persons" WHERE ("persons"."person_id" = 517) LIMIT 1
为什么是这样?我认为 Rails 应该在每个请求的基础上默认启用查询缓存?
config/development.rb:
config.cache_classes = false
config.perform_caching = true
. . .
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = true
config.active_support.deprecation = :log