private function getExhibitionItemsCacheKey($titleText) { return wfmemcKey(__CLASS__, 'Exhibition', md5($titleText), self::CACHE_VERSION); }
public function getDescription($bParse = true) { /** @var $title Title */ $title = $this->getTitle(); $memcKey = wfmemcKey(__METHOD__, $title->getArticleID(), $title->getTouchedCached(), 'parsed'); $res = $this->wg->memc->get($memcKey); if (!is_string($res)) { if (!$bParse) { $oArticle = new Article($title); return $oArticle->getText(); } $res = $this->getDescriptionParsed(false); $this->wg->memc->set($memcKey, $res, self::DESCRIPTION_CACHE_TTL); } return $res; }
private static function generateCacheKey($articleID) { return wfmemcKey('LandingPagesAsContent', $articleID); }
public function strip_wikitext($text, Title $title = null) { $app = F::app(); // use memcached on top of Parser $textHash = md5($text); $key = wfmemcKey(__METHOD__, $textHash); $cachedText = $app->wg->memc->get($key); if (!empty($cachedText)) { return $cachedText; } $text = str_replace('*', '&asterix;', $text); if (empty($title)) { $title = $app->wg->Title; } // local parser to fix the issue fb#17907 $text = ParserPool::parse($text, $title, $app->wg->Out->parserOptions())->getText(); // BugId:31034 - I had to give ENT_COMPAT and UTF-8 explicitly. // Prior PHP 5.4 the defaults are ENT_COMPAT and ISO-8859-1 (not UTF-8) // and cause HTML entities in an actual UTF-8 string to be decoded incorrectly // and displayed in... an ugly way. $text = trim(strip_tags(html_entity_decode($text, ENT_COMPAT, 'UTF-8'))); $text = str_replace('&asterix;', '*', $text); $app->wg->memc->set($key, $text, self::PARSER_CACHE_TTL); return $text; }