本文整理汇总了PHP中SearchForm::getCacheKey方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchForm::getCacheKey方法的具体用法?PHP SearchForm::getCacheKey怎么用?PHP SearchForm::getCacheKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchForm
的用法示例。
在下文中一共展示了SearchForm::getCacheKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCachedTitles
private function getCachedTitles()
{
global $wgMemc, $wgUser;
$titles = array();
$cacheKey = SearchForm::getCacheKey();
$cacheData = $wgMemc->get($cacheKey);
if (!isset($cacheData) || $cacheData === false) {
$dbr =& wfGetDB(DB_SLAVE);
$use_index = $dbr->useIndexClause('user_timestamp');
extract($dbr->tableNames('page', 'revision', 'index_checkpoint'));
$sql = "SELECT\n page_namespace,page_title\n FROM {$index_checkpoint},{$page},{$revision} {$use_index}\n WHERE ic_name='revisions' AND page_id=rev_page AND rev_user = {$wgUser->getID()} AND rev_timestamp >= ic_rev_timestamp\n ORDER BY rev_timestamp DESC";
$sql = $dbr->limitResult($sql, 50);
$rows = $dbr->query($sql, 'SpecialSearch');
while ($row = $dbr->fetchObject($rows)) {
$t = Title::makeTitle($row->page_namespace, $row->page_title);
$titleString = $t->getPrefixedText();
if (!in_array($titleString, $titles)) {
$titles[] = $titleString;
}
}
$dbr->freeResult($rows);
$cacheData = join('|', $titles);
$wgMemc->set($cacheKey, $cacheData, self::CACHE_EXP_TIME);
} else {
if ($cacheData) {
$titles = explode('|', $cacheData);
}
}
return $titles;
}