forked from GNUsocial/gnu-social
cache getReplies() values
This commit is contained in:
parent
419ae3f18d
commit
f9dc2fc0ab
@ -1208,23 +1208,28 @@ class Notice extends Memcached_DataObject
|
|||||||
*/
|
*/
|
||||||
function getReplies()
|
function getReplies()
|
||||||
{
|
{
|
||||||
// XXX: cache me
|
$keypart = sprintf('notice:reply_ids:%d', $this->id);
|
||||||
|
|
||||||
$ids = array();
|
$idstr = self::cacheGet($keypart);
|
||||||
|
|
||||||
$reply = new Reply();
|
if ($idstr !== false) {
|
||||||
$reply->selectAdd();
|
$ids = explode(',', $idstr);
|
||||||
$reply->selectAdd('profile_id');
|
} else {
|
||||||
$reply->notice_id = $this->id;
|
$ids = array();
|
||||||
|
|
||||||
if ($reply->find()) {
|
$reply = new Reply();
|
||||||
while($reply->fetch()) {
|
$reply->selectAdd();
|
||||||
$ids[] = $reply->profile_id;
|
$reply->selectAdd('profile_id');
|
||||||
|
$reply->notice_id = $this->id;
|
||||||
|
|
||||||
|
if ($reply->find()) {
|
||||||
|
while($reply->fetch()) {
|
||||||
|
$ids[] = $reply->profile_id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
self::cacheSet($keypart, implode(',', $ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
$reply->free();
|
|
||||||
|
|
||||||
return $ids;
|
return $ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user