/** * Получить комменты по рейтингу и дате * * @param string $sDate Дата за которую выводить рейтинг, т.к. кеширование происходит по дате, то дату лучше передавать с точностью до часа (минуты и секунды как 00:00) * @param string $sTargetType Тип владельца комментария * @param int $iLimit Количество элементов * @return array */ public function GetCommentsRatingByDate($sDate, $sTargetType, $iLimit = 20) { /** * Выбираем топики, комметарии к которым являются недоступными для пользователя */ $aCloseBlogs = $this->oUserCurrent ? $this->Blog_GetInaccessibleBlogsByUser($this->oUserCurrent) : $this->Blog_GetInaccessibleBlogsByUser(); $s = serialize($aCloseBlogs); /** * Т.к. время передаётся с точностью 1 час то можно по нему замутить кеширование */ if (false === ($data = $this->Cache_Get("comment_rating_{$sDate}_{$sTargetType}_{$iLimit}_{$s}"))) { $data = $this->oMapper->GetCommentsRatingByDate($sDate, $sTargetType, $iLimit, array(), $aCloseBlogs); $this->Cache_Set($data, "comment_rating_{$sDate}_{$sTargetType}_{$iLimit}_{$s}", array("comment_new_{$sTargetType}", "comment_update_status_{$sTargetType}", "comment_update_rating_{$sTargetType}"), 60 * 60 * 24 * 2); } $data = $this->GetCommentsAdditionalData($data); return $data; }