function getNotices($offset, $limit, $sinceId = null, $maxId = null) { $all = Memcached_DataObject::listGet('Notice', 'conversation', array($this->id)); $notices = $all[$this->id]; // Re-order in reverse-chron usort($notices, array('RawConversationNoticeStream', '_reverseChron')); // FIXME: handle since and max $wanted = array_slice($notices, $offset, $limit); return new ArrayWrapper($wanted); }
static function fillRepeats(&$notices) { $ids = self::_idsOf($notices); $repeatMap = Memcached_DataObject::listGet('Notice', 'repeat_of', $ids); foreach ($notices as $notice) { $repeats = $repeatMap[$notice->id]; $notice->_setRepeats($repeats); } }
function _allNotices($notices) { $convId = array(); foreach ($notices as $notice) { $convId[] = $notice->conversation; } $convId = array_unique($convId); $allMap = Memcached_DataObject::listGet('Notice', 'conversation', $convId); $allArray = array(); foreach ($allMap as $convId => $convNotices) { $allArray = array_merge($allArray, $convNotices); } return $allArray; }
function getMessagesFrom() { $msgMap = Memcached_DataObject::listGet('Message', 'from_profile', array($this->user->id)); $messages = $msgMap[$this->user->id]; if (!empty($this->after)) { $messages = array_filter($messages, array($this, 'createdAfter')); } return $messages; }