示例#1
0
 /**
  * Clears the cache entry for a specific module or all modules.
  *
  * @param string|null $moduleName If null, all cache for all modules is cleared.
  *
  * @return bool
  */
 public function clearModuleCache($moduleName = null)
 {
     if ($this->_moduleCache) {
         if (null !== $moduleName) {
             return $this->_moduleCache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('module', $moduleName));
         }
         return $this->_moduleCache->clean(Zend_Cache::CLEANING_MODE_ALL);
     }
 }
示例#2
0
 /**
  * Clean all cache entries
  *
  * @return boolean
  * @throws coding_exception
  */
 public function clean()
 {
     if ($this->cache === false) {
         return true;
     }
     try {
         return $this->cache->clean();
     } catch (Zend_Cache_Exception $e) {
         throw new coding_exception('Zend Cache Error: ' . $e->getMessage());
     }
 }
示例#3
0
 /**
  * Delete a queue and all of it's messages
  *
  * @param  string  $name queue name
  * @return boolean True
  */
 public function delete($name)
 {
     $queues = $this->_cache->load(self::DEFAULT_QUEUE_KEY);
     if (is_array($queues)) {
         foreach ($queues as $key => &$queue) {
             if ($queue['name'] == $name) {
                 unset($queues[$key]);
                 break;
             }
         }
     }
     // Delete any messages in the queue
     $this->_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array($name));
     return $this->_cache->save($queues, self::DEFAULT_QUEUE_KEY, array(), 0);
 }
示例#4
0
 /**
  * Metodo que faz limpeza do Cache (Memcached ou Filesystem)
  * das duas instancias de cache do MPE: cache_FS e cache_acl
  * 
  * Como chamar via admim:
  * 
  * http://[mpe-dominio]/cache/clean-all-caches
  * 
  * @author esilva
  * 
  * @param Zend_Cache $cache
  */
 public function cleanAllCachesAction(Zend_Cache $cache = null)
 {
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $this->cache = Zend_Registry::get('cache_FS');
     $this->cache2 = Zend_Registry::get('cache_acl');
     echo "<br>Inserindo conteudo no Cache (Memcached ou Filesystem) <br><br>";
     $this->cache->save('conteudo variavel teste eh este!!', 'teste');
     $testando = $this->cache->load('teste');
     $this->cache2->save('conteudo variavel testeAcl eh este!!', 'testeAcl');
     $testandoAcl = $this->cache2->load('testeAcl');
     sleep(1);
     echo "";
     var_dump('teste_var (cache): ', $testando);
     var_dump('teste_var_acl (cache): ', $testandoAcl);
     echo "<br><BR>LIMPANDO CACHE!!!<br><BR>";
     // clean all records
     $this->cache->clean(Zend_Cache::CLEANING_MODE_ALL);
     $this->cache2->clean(Zend_Cache::CLEANING_MODE_ALL);
     // clean only outdated
     $this->cache->clean(Zend_Cache::CLEANING_MODE_OLD);
     $this->cache2->clean(Zend_Cache::CLEANING_MODE_OLD);
     sleep(2);
     echo "<br> [Verificação da limpeza do cache]<Br><BR>";
     $testando = $this->cache->load('teste');
     $testando2 = $this->cache->load('teste2');
     $testando3 = $this->cache->load('teste3');
     $testandoAcl = $this->cache2->load('testeAcl');
     //recupera do cache
     if ($testando == false) {
         echo "variavel [teste] não mais existe<br>";
         echo "variavel [teste2] não mais existe<br>";
         echo "variavel [teste3] não mais existe<br>";
         echo "variavel [testeAcl] não mais existe<br>";
     } else {
         echo "variavel [teste] existe no cache: ";
         echo "teste: " . $testando . "<br>";
         echo "variavel [teste2] existe no cache: ";
         echo "teste2: " . $testando2 . "<br>";
         echo "variavel [teste3] existe no cache: ";
         echo "teste3: " . $testando3 . "<br>";
         echo "variavel [testeAcl] existe no cache: ";
         echo "testeAcl: " . $testandoAcl . "<br>";
     }
 }
示例#5
0
文件: Cache.php 项目: ngchie/system
 /**
  * method to clean all cache tier
  * 
  * @return mixed the value in the cache
  */
 public function clean()
 {
     return $this->cache->clean();
 }
示例#6
0
 /**
  * Refresh Cache
  *
  * Clears all cached information for SimpleDb and refreshes items
  * that will not refresh themselves.
  *
  * @param void
  * @return void
  */
 public function refreshCache()
 {
     $this->_cache->clean(Zend_Cache::CLEANING_MODE_ALL);
     $this->_loadTableNames();
     $this->_tableInfo = array();
 }