/**
  * Remove the item from the cache.
  *
  * Remove an item from cache with identified by $key after $time seconds. The
  * $time parameter allows an object to be queued for deletion without immediately
  * deleting. Between the time that it is queued and the time it's deleted, add,
  * replace, and get will fail, but set will succeed.
  *
  * @link http://www.php.net/manual/en/memcached.delete.php
  *
  * @param   string      $key        The key under which to store the value.
  * @param   string      $group      The group value appended to the $key.
  * @param   int         $time       The amount of time the server will wait to delete the item in seconds.
  * @param   string      $server_key The key identifying the server to store the value on.
  * @param   bool        $byKey      True to store in internal cache by key; false to not store by key
  * @return  bool                    Returns TRUE on success or FALSE on failure.
  */
 public function delete($key, $group = 'default', $time = 0, $server_key = '', $byKey = false)
 {
     $derived_key = $this->buildKey($key, $group);
     // Remove from no_mc_groups array
     if (in_array($group, $this->no_mc_groups)) {
         if (isset($this->cache[$derived_key])) {
             unset($this->cache[$derived_key]);
         }
         return true;
     }
     $result = false !== $byKey ? $this->daemon->deleteByKey($server_key, $derived_key, $time) : $this->daemon->delete($derived_key, $time);
     $r_code = $this->getResultCode();
     if (Memcached::RES_SUCCESS === $r_code) {
         unset($this->cache[$derived_key]);
     }
     return $result;
 }
Пример #2
0
 /**
  * delete method multiserver pools
  *
  * @param $server_key string
  * @param $key        string
  * @param $time       int
  *
  * @return boolean
  */
 public function deleteByKey(string $server_key, string $key, int $time = 0) : bool
 {
     if (parent::deleteByKey($server_key, $key, $time ? $time : null)) {
         unset($this->cacheListing[$key]);
         $this->saveCacheListing();
         return true;
     }
     return false;
 }
Пример #3
0
 /**
  * delete method multiserver pools
  *
  * @param $server_key string            
  * @param $key string            
  * @param $time int            
  *
  * @return boolean
  */
 public function deleteByKey($server_key, $key, $time = 0)
 {
     if (parent::deleteByKey($server_key, $key, $time ? $time : NULL)) {
         unset($this->cache_listing[$key]);
         $this->save_cache_listing();
         return TRUE;
     }
     return FALSE;
 }
 /**
  * @inheritdoc
  */
 public function deleteMultiByKey($server_key, $keys, $time = null)
 {
     $keys = $this->prefixArrayOfKeys($keys);
     return parent::deleteByKey($server_key, $keys, $time);
 }