PhilipDaineko/GreatWork — Issue #11: make questions cacheable
Author: PhilipDaineko
Created: 2012-01-14 09:50:41+00:00
State: open

when accessing user#show many sql are getting executed
User Load (1.0ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2 LIMIT 1
Answer Load (4.0ms) SELECT `answers`.* FROM `answers` WHERE `answers`.`user_id` = 2
Question Load (3.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 1 LIMIT 1
Question Load (2.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 2 LIMIT 1
Question Load (4.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 3 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 1 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 2 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 3 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 1 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 2 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 3 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 1 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 2 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 3 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 1 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 2 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 3 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 1 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 2 LIMIT 1
CACHE (0.0ms) SELECT `questions`.* FROM `questions` WHERE `questions`.`id` = 3 LIMIT 1

need cache