From 731bdab804d78012279c6d09a8d4fe783f00593d Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 7 Apr 2011 16:57:16 -0400 Subject: [PATCH] Use pkeyGet() instead of idStream() for fave caching --- classes/Profile.php | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/classes/Profile.php b/classes/Profile.php index b8c4932780..2c15826282 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -471,34 +471,6 @@ class Profile extends Memcached_DataObject function hasFave($notice) { - $cache = Cache::instance(); - - // XXX: Kind of a hack. - - if (!empty($cache)) { - // This is the stream of favorite notices, in rev chron - // order. This forces it into cache. - - $ids = Fave::idStream($this->id, 0, CachingNoticeStream::CACHE_WINDOW); - - // If it's in the list, then it's a fave - - if (in_array($notice->id, $ids)) { - return true; - } - - // If we're not past the end of the cache window, - // then the cache has all available faves, so this one - // is not a fave. - - if (count($ids) < CachingNoticeStream::CACHE_WINDOW) { - return false; - } - - // Otherwise, cache doesn't have all faves; - // fall through to the default - } - $fave = Fave::pkeyGet(array('user_id' => $this->id, 'notice_id' => $notice->id)); return ((is_null($fave)) ? false : true); -- 2.39.5