【发布时间】:2023-03-15 16:21:01
【问题描述】:
在我的开发环境中,我有一个生成数百个相同查询的请求:
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
【问题讨论】:
-
生产环境中是否缓存了查询?
标签: ruby-on-rails ruby-on-rails-3 query-cache