本文整理匯總了PHP中_root::getCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP _root::getCache方法的具體用法?PHP _root::getCache怎麽用?PHP _root::getCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類_root
的用法示例。
在下文中一共展示了_root::getCache方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _list
public function _list()
{
//cache
if (_root::getCache()->isCached('sidebar_categories')) {
$oView = _root::getCache()->getCached('sidebar_categories');
return $oView;
}
$tCategories = model_categories::getInstance()->findAll();
$oView = new _view('categories::list');
$oView->tCategories = $tCategories;
_root::getCache()->setCache('sidebar_categories', $oView);
return $oView;
}
示例2: _lastList
public function _lastList()
{
//cache
if (_root::getCache()->isCached('sidebar_lastpost')) {
$oView = _root::getCache()->getCached('sidebar_lastpost');
return $oView;
}
$tPosts = model_posts::getInstance()->findLast();
$oView = new _view('posts::smalllist');
$oView->tPosts = $tPosts;
$oView->tJoinmodel_categories = model_categories::getInstance()->getSelect();
$oView->tJoinmodel_users = model_users::getInstance()->getSelect();
_root::getCache()->setCache('sidebar_lastpost', $oView);
return $oView;
}
示例3: processSave
private function processSave()
{
if (!_root::getRequest()->isPost()) {
//si ce n'est pas une requete POST on ne soumet pas
return null;
}
$oPluginXsrf = new plugin_xsrf();
if (!$oPluginXsrf->checkToken(_root::getParam('token'))) {
//on verifie que le token est valide
return array('token' => $oPluginXsrf->getMessage());
}
$iId = _root::getParam('id', null);
if ($iId == null) {
$oPosts = new row_posts();
} else {
$oPosts = model_posts::getInstance()->findById(_root::getParam('id', null));
}
$tColumn = array('category_id', 'user_id', 'name', 'slug', 'content');
foreach ($tColumn as $sColumn) {
$oPosts->{$sColumn} = _root::getParam($sColumn, null);
}
if ($oPosts->save()) {
if (_root::getCache()->isCached('sidebar_lastpost')) {
_root::getCache()->clearCache('sidebar_lastpost');
}
if (_root::getCache()->isCached('sidebar_categories')) {
_root::getCache()->clearCache('sidebar_categories');
}
//une fois enregistre on redirige (vers la page liste)
_root::redirect('privatePosts::list');
} else {
return $oPosts->getListError();
}
}