Rails日志。这是什么意思

时间:2010-11-25 19:47:08

标签: ruby-on-rails logging

我在开发日志中得到了这个。 mCACHE线是什么意思?他们是SQL查询吗?

 ←[1m←[36mTodo Load (1.0ms)←[0m  ←[1mSELECT "todos".* FROM "todos" WHERE ("todos".project_id IN (4,5,6,7,8,9,10,11,12,13))←[0m
 ←[1m←[35mLog Load (1.0ms)←[0m  SELECT "logs".* FROM "logs" WHERE ("logs".todo_id IN (134,135,136))
 ←[1m←[36mCACHE (0.0ms)←[0m  ←[1mSELECT "firms".* FROM "firms" WHERE ("firms"."id" = 2) LIMIT 1←[0m
 ←[1m←[35mCACHE (0.0ms)←[0m  SELECT "users".* FROM "users" WHERE ("users"."id" = 3) LIMIT 1
 ←[1m←[36mCACHE (0.0ms)←[0m  ←[1mSELECT "users".* FROM "users" WHERE ("users"."id" = 3) LIMIT 1←[0m
 ←[1m←[35mCACHE (0.0ms)←[0m  SELECT "users".* FROM "users" WHERE ("users"."id" = 3) LIMIT 1
 ←[1m←[36mCACHE (0.0ms)←[0m  ←[1mSELECT "firms".* FROM "firms" WHERE ("firms"."id" = 2) LIMIT 1←[0m
 ←[1m←[35mCACHE (0.0ms)←[0m  SELECT "firms".* FROM "firms" WHERE ("firms"."id" = 2) LIMIT 1
 ←[1m←[36mCACHE (0.0ms)←[0m  ←[1mSELECT "firms".* FROM "firms" WHERE ("firms"."id" = 2) LIMIT 1←[0m
 ←[1m←[35mCACHE (0.0ms)←[0m  SELECT "firms".* FROM "firms" WHERE ("firms"."id" = 2) LIMIT 1
 ←[1m←[36mCACHE (0.0ms)←[0m  ←[1mSELECT "firms".* FROM "firms" WHERE ("firms"."id" = 2) LIMIT 1←[0m
 ←[1m←[35mCACHE (0.0ms)←[0m  SELECT "firms".* FROM "firms" WHERE ("firms"."id" = 2) LIMIT 1
 ←[1m←[36mCACHE (0.0ms)←[0m  ←[1mSELECT "firms".* FROM "firms" WHERE ("firms"."id" = 2) LIMIT 1←[0m
 ←[1m←[35mCACHE (0.0ms)←[0m  SELECT "firms".* FROM "firms" WHERE ("firms"."id" = 2) LIMIT 1
 ←[1m←[36mCACHE (0.0ms)←[0m  ←[1mSELECT "firms".* FROM "firms" WHERE ("firms"."id" = 2) LIMIT 1←[0m

3 个答案:

答案 0 :(得分:4)

[numberm只是ANSI color codes - 它应该在智能终端中显示漂亮的颜色,否则看起来很糟糕。

CACHE是“一个sql查询,缓存(以前执行,现在从缓存中加载)” - 参见例如this

答案 1 :(得分:3)

这是Rails SQL Caching正在运行的证据:

http://guides.rubyonrails.org/caching_with_rails.html#sql-caching

答案 2 :(得分:2)

缓存意味着您已经运行了相同的查询,并且其结果存储在内存中,因此查询实际上并不针对数据库运行。它们都是查询,它是Active Record在与数据库通信时实际执行的操作。