示例#1
0
 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
0
 /**
  * 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;
 }