function attachments() { if ($this->_attachments != -1) { return $this->_attachments; } $f2ps = Memcached_DataObject::listGet('File_to_post', 'post_id', array($this->id)); $ids = array(); foreach ($f2ps[$this->id] as $f2p) { $ids[] = $f2p->file_id; } $files = Memcached_DataObject::multiGet('File', 'id', $ids); $this->_attachments = $files->fetchAll(); return $this->_attachments; }
/** * Pre-cache our spam scores if needed. */ function onEndNoticeListPrefill(&$notices, &$profiles, $avatarSize) { if ($this->hideSpam) { foreach ($notices as $notice) { $ids[] = $notice->id; } Memcached_DataObject::multiGet('Spam_score', 'notice_id', $ids); } return true; }