本文整理汇总了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();
}
}