Exemplo n.º 1
0
 /**
  * @param  string $id
  * @return bool true if OK
  */
 public function remove($id)
 {
     $this->checkCacheConsistency();
     $result = parent::remove($id);
     // using func_get_arg() to be compatible with the interface
     // when the 2ng argument is true, do not clean the cache tags
     if ($result && func_num_args() > 1 && func_get_arg(1) !== true) {
         $this->getDb()->delete("cache_tags", "id = '" . $id . "'");
     }
     // security check if the deletion fails
     if (!$result && $this->_memcache->get($id) !== false) {
         $this->_memcache->flush();
     }
     return $result;
 }
Exemplo n.º 2
0
 public function remove($id)
 {
     $id = $this->_processId($id);
     try {
         return parent::remove($id);
     } catch (ErrorException $e) {
         if ($e->getSeverity() == E_NOTICE) {
             $e = new Kwf_Exception_Other($e);
             $e->logOrThrow();
             return false;
         }
         throw $e;
     }
 }
 public function remove($id)
 {
     return parent::remove($this->_makeId($id));
 }
Exemplo n.º 4
0
 /**
  * @param  string $id
  * @return bool true if OK
  */
 public function remove($id)
 {
     $this->checkCacheConsistency();
     $this->getDb()->delete("cache_tags", "id = '" . $id . "'");
     $result = parent::remove($id);
     // security check if the deletion fails
     if (!$result && $this->_memcache->get($id) !== false) {
         $this->_memcache->flush();
     }
     return $result;
 }
Exemplo n.º 5
0
 private function removeSliced($id, $slicesAmount, $skipCheck = false)
 {
     $result = false;
     for ($i = 0; $i < $slicesAmount; $i++) {
         $sliceKey = $id . "_slice_" . $i;
         $result = parent::remove($sliceKey);
         // security check if the deletion fails
         if (!$result && !$skipCheck && $this->_memcache->get($sliceKey) !== false) {
             Logger::warn("Error deleting slice #" . $i . " for key " . $id . " (" . $sliceKey . ") - flushing memcache!");
             $result = $this->_memcache->flush();
         }
     }
     return $result;
 }