cache getReplies() values

This commit is contained in:
Evan Prodromou 2011-04-06 23:46:51 -04:00
parent 419ae3f18d
commit f9dc2fc0ab

View File

@ -1208,8 +1208,13 @@ class Notice extends Memcached_DataObject
*/
function getReplies()
{
// XXX: cache me
$keypart = sprintf('notice:reply_ids:%d', $this->id);
$idstr = self::cacheGet($keypart);
if ($idstr !== false) {
$ids = explode(',', $idstr);
} else {
$ids = array();
$reply = new Reply();
@ -1222,8 +1227,8 @@ class Notice extends Memcached_DataObject
$ids[] = $reply->profile_id;
}
}
$reply->free();
self::cacheSet($keypart, implode(',', $ids));
}
return $ids;
}