Метод GetCountCommentsByUserId не кеширует данные (LiveStreet 1.0.3)
Привет!
В поисках причины генерации страницы профиля более одной секунды в методе GetCountCommentsByUserId была найдена проблема. При большом количестве топиков скорость генерации страниц падает. Запрос проходил по 0.7 секунд.
Вместо:
В версии LiveStreet 2.* это исправлено.
В поисках причины генерации страницы профиля более одной секунды в методе GetCountCommentsByUserId была найдена проблема. При большом количестве топиков скорость генерации страниц падает. Запрос проходил по 0.7 секунд.
Вместо:
public function GetCountCommentsByUserId($sId,$sTargetType) { /** * Исключаем из выборки идентификаторы закрытых блогов */ $aCloseBlogs = ($this->oUserCurrent && $sId==$this->oUserCurrent->getId()) ? array() : $this->Blog_GetInaccessibleBlogsByUser(); $s=serialize($aCloseBlogs); if (false === ($data = $this->Cache_Get("comment_count_user_{$sId}_{$sTargetType}_{$s}"))) { $data = $this->oMapper->GetCountCommentsByUserId($sId,$sTargetType,array(),$aCloseBlogs); $this->Cache_Set($data, "comment_count_user_{$sId}_{$sTargetType}", array("comment_new_user_{$sId}_{$sTargetType}","comment_update_status_{$sTargetType}"), 60*60*24*2); } return $data; }Заменить на:
public function GetCountCommentsByUserId($sId,$sTargetType) { /** * Исключаем из выборки идентификаторы закрытых блогов */ $aCloseBlogs = ($this->oUserCurrent && $sId==$this->oUserCurrent->getId()) ? array() : $this->Blog_GetInaccessibleBlogsByUser(); $s=serialize($aCloseBlogs); if (false === ($data = $this->Cache_Get("comment_count_user_{$sId}_{$sTargetType}_{$s}"))) { $data = $this->oMapper->GetCountCommentsByUserId($sId,$sTargetType,array(),$aCloseBlogs); $this->Cache_Set($data, "comment_count_user_{$sId}_{$sTargetType}_{$s}", array("comment_new_user_{$sId}_{$sTargetType}","comment_update_status_{$sTargetType}"), 60*60*24*2); } return $data; }
В версии LiveStreet 2.* это исправлено.
0 комментариев