From: Evan Prodromou Date: Thu, 7 Apr 2011 20:57:16 +0000 (-0400) Subject: Use pkeyGet() instead of idStream() for fave caching X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=731bdab804d78012279c6d09a8d4fe783f00593d;p=quix0rs-gnu-social.git Use pkeyGet() instead of idStream() for fave caching --- 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);