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