本文整理匯總了PHP中Globals::getCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP Globals::getCache方法的具體用法?PHP Globals::getCache怎麽用?PHP Globals::getCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Globals
的用法示例。
在下文中一共展示了Globals::getCache方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: cacheCleanAction
function cacheCleanAction()
{
if ($this->getRequest()->getOption('all')) {
Globals::getCache()->clean(Zend_Cache::CLEANING_MODE_ALL);
} else {
Globals::getCache()->clean(Zend_Cache::CLEANING_MODE_OLD);
}
}
示例2: _handleCacheResult
/**
* Handles our caching functionality
*
* Is used to determine whether we have something cached
* if we do we retrieve it, otherwise we call the necessary function
*
* @param String $cacheTitle The name of the cache
* @param String $object The object to which the call is made
* @param String $method
* @param String $args
* @return mixed $result Our result, cached or fresh if cache expires
*
*/
function _handleCacheResult($cacheTitle, $object, $method, $args = null)
{
$cacheTitle = str_replace('-', '_', $cacheTitle);
if (!($result = Globals::getCache()->load($cacheTitle))) {
if (null == $args) {
$results = $this->{$object}->{$method}();
} else {
if (is_array($args)) {
$results = $this->{$object}->{$method}(implode(',', $args));
} else {
$results = $this->{$object}->{$method}($args);
}
}
$this->_cache->save($results, $cacheTitle);
} else {
$results = $result;
}
return $results;
}