Use pkeyGet() instead of idStream() for fave caching
This commit is contained in:
parent
adf4d96013
commit
731bdab804
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user