Exemplo n.º 1
0
 /**
  * @see Zend_Cache_Backend_Apc::clean()
  *
  * @param  string $mode clean mode
  * @param  array  $tags array of tags
  * @return boolean true if no problem
  */
 public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
 {
     if ($mode == Zend_Cache::CLEANING_MODE_ALL) {
         return parent::clean($mode, $tags);
     }
     if ($mode == Zend_Cache::CLEANING_MODE_OLD) {
         $this->_log("Better_Cache_Backend_Apc::clean() : CLEANING_MODE_OLD is unsupported by the Apc backend");
     }
     if ($mode == Zend_Cache::CLEANING_MODE_MATCHING_TAG) {
         $tagArray = unserialize(apc_fetch(self::TAG_LIST));
         foreach ($tagArray as $tag => $items) {
             if (in_array($tag, $tags)) {
                 foreach ($items as &$id) {
                     $this->remove($id);
                 }
             }
         }
         return true;
     }
     if ($mode == Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG) {
         $tagArray = unserialize(apc_fetch(self::TAG_LIST));
         foreach ($tagArray as $tag => &$items) {
             if (!in_array($tag, $tags)) {
                 foreach ($items as $id) {
                     $this->remove($id);
                     unset($id);
                 }
             }
         }
         return true;
     }
     return false;
 }