/**
  * Delete an item from the memcache server
  *
  * @param string $key
  * @return
  */
 public function delete($key)
 {
     if (!$this->hasMemcache) {
         return false;
     }
     return $this->memcache->delete($key);
 }
Beispiel #2
0
 function delete($key)
 {
     if (null === $this->memcache) {
         $this->connect();
     }
     return $this->memcache->delete($key);
 }
Beispiel #3
0
 public function dropAll()
 {
     foreach ($this->cache->get(self::INTERNAL_PREFIX . 'all-keys') as $key) {
         $this->drop($key);
     }
     $this->cache->delete(self::INTERNAL_PREFIX . 'all-data');
 }
Beispiel #4
0
 public function remove($key)
 {
     if (\Kalibri::config()->get('debug.log.is-enabled', false)) {
         \Kalibri::logger()->add(\Kalibri\Logger\Base::L_DEBUG, 'REMOVE: ' . $key, $this);
     }
     unset($this->_local[$key]);
     return $this->_memcache->delete($key);
 }
 /**
  * Remove values from cache.
  *
  * @param array $keys list of keys to delete
  *
  * @return bool true on success, false on failure
  */
 protected function delete(array $keys)
 {
     foreach ($keys as $k) {
         $k = sha1($k);
         $this->memcache->delete($k);
     }
     return true;
 }
 /**
  * Release lock
  *
  * @param string $name name of lock
  * @return bool
  */
 public function releaseLock($name)
 {
     if (isset($this->keys[$name]) && $this->memcache->delete($name)) {
         unset($this->keys[$name]);
         return true;
     }
     return false;
 }
Beispiel #7
0
 /**
  * @inheritdoc
  */
 public function removeTag($tag)
 {
     $tag = $this->prepareTag($tag);
     if (($value = $this->storage->get($tag)) === false) {
         return false;
     }
     $value = $this->unserialize($value);
     $value[] = $tag;
     foreach ($value as $key) {
         $this->storage->delete($key);
     }
     return true;
 }
 /**
  * Delete cache item with given key
  * @param string $key
  */
 public function delete($key)
 {
     if (empty($key)) {
         throw new InvalidArgumentException("\$key is empty");
     }
     return $this->memcache->delete($key);
 }
 /**
  * Removes a cache record.
  *
  * @param string $id Cache id
  *
  * @return boolean TRUE if cache is removed FALSE otherwise
  */
 public function remove($id)
 {
     if (false === $this->_cache->delete($id)) {
         return $this->_onError('remove');
     }
     return true;
 }
Beispiel #10
0
 /**
  * 设定该k一个过期时间
  * @param int $expire 在$expire秒后过期
  */
 public function expire($expire)
 {
     if ($expire <= 0) {
         return FALSE;
     }
     return $this->mc->delete($this->k, $expire);
 }
Beispiel #11
0
 /**
  * Attempt to remove a key value pair from memcache.
  *
  * @param string $key index to remove from memcache
  * @param int $delay - Length of time before deletion. (0 = immediately; n = seconds)
  * @return bool
  **/
 public function delete($key, $delay = 0)
 {
     if ($this->open()) {
         return $this->memcache->delete($key, $delay);
     }
     return false;
 }
Beispiel #12
0
	/**
	 * @param string $sKey
	 *
	 * @return void
	 */
	public function Delete($sKey)
	{
		if ($this->oMem)
		{
			$this->oMem->delete($this->generateCachedKey($sKey));
		}
	}
 /**
  * destroy of the session
  *
  * @param string $sessionId
  * @return bool
  */
 public function destroy($sessionId)
 {
     $this->_memcache->delete(Kwf_Cache_Simple::getUniquePrefix() . 'sess-' . $sessionId);
     $this->_memcache->delete(Kwf_Cache_Simple::getUniquePrefix() . 'sess-db-' . $sessionId);
     Kwf_Registry::get('db')->query("DELETE FROM kwf_sessions WHERE sessionId=?", $sessionId);
     return true;
 }
 /**
  * Simulates multiDelete operation, since Memcache extension does not support
  *
  * {@inheritDoc}
  *
  * @see http://www.php.net/manual/en/memcache.delete.php
  */
 protected function _deleteMulti(array $keys)
 {
     foreach ($keys as $key) {
         $this->_connection->delete($key);
     }
     return true;
 }
 /**
  * Destroy a session.
  * Expects a session id.
  * @param string $sessionId
  * @return boolean
  */
 public function destroy($sessionId = '')
 {
     if ($sessionId !== '') {
         $this->_memcache->delete($this->_key($sessionId));
     }
     return true;
 }
Beispiel #16
0
 /**
  * 批量设置键值(当键名不存在时);<br>
  * 只有当键值全部设置成功时,才返回true,否则返回false并尝试回滚
  * @param array $sets   键值数组
  * @return boolean      是否成功
  */
 public function mSetNX($sets)
 {
     try {
         $keys = [];
         $status = true;
         foreach ($sets as $key => $value) {
             $value = self::setValue($value);
             $status = $this->handler->add($key, $value, $this->compress($value));
             if ($status) {
                 $keys[] = $key;
             } else {
                 break;
             }
         }
         //如果失败,尝试回滚,但不保证成功
         if (!$status) {
             foreach ($keys as $key) {
                 $this->handler->delete($key);
             }
         }
         return $status;
     } catch (Exception $ex) {
         self::exception($ex);
         //连接状态置为false
         $this->isConnected = false;
     }
     return false;
 }
 /**
  * Delete data from cache
  *
  * @param array $keys array of keys to delete
  * @return boolean true on success
  */
 protected function delete(array $keys)
 {
     foreach ($keys as $key) {
         $this->memcacheObj->delete(sha1($key));
     }
     return true;
 }
 /**
  * @see Cache::_delete()
  */
 protected function _delete($key)
 {
     if (!$this->is_connected) {
         return false;
     }
     return $this->memcache->delete($key);
 }
Beispiel #19
0
 /**
  * @param string $id - session id, must be valid hash
  * @return bool
  */
 public static function destroy($id)
 {
     if (!self::isValidId($id)) {
         return false;
     }
     if (self::$isReadOnly) {
         return false;
     }
     $isConnectionRestored = false;
     if (!self::isConnected()) {
         $isConnectionRestored = self::newConnection();
     }
     if (!self::isConnected()) {
         return false;
     }
     $sid = self::getPrefix();
     self::$connection->delete($sid . $id);
     if (CSecuritySession::isOldSessionIdExist()) {
         self::$connection->delete($sid . CSecuritySession::getOldSessionId());
     }
     if ($isConnectionRestored) {
         self::closeConnection();
     }
     return true;
 }
 /**
  * Deletes the data for a given key.
  * 
  * Returns true on successful deletion, false if unsuccessful.
  *
  * @param string $key
  * @return boolean
  */
 public function delete($key, $partition = '')
 {
     if (!$this->connected) {
         return false;
     }
     return $this->memcache->delete($this->addNamespace($key, $partition));
 }
 /**
  * (non-PHPdoc)
  * @see \Skinny\Cache::remove()
  */
 public function remove($key)
 {
     if (!$this->connected) {
         return false;
     }
     return $this->memcache->delete($key);
 }
 /**
  * Removes association of the identifier with the given tags
  *
  * @param string $entryIdentifier
  * @param array Array of tags
  * @author Karsten Dambekalns <*****@*****.**>
  * @author	Dmitry Dulepov <*****@*****.**>
  * @internal
  */
 protected function removeIdentifierFromAllTags($entryIdentifier)
 {
     if ($this->serverConnected) {
         // Get tags for this identifier
         $tags = $this->findTagsByIdentifier($entryIdentifier);
         // Deassociate tags with this identifier
         foreach ($tags as $tag) {
             $identifiers = $this->findIdentifiersByTag($tag);
             // Formally array_search() below should never return false
             // due to the behavior of findTagsForIdentifier(). But if
             // reverse index is corrupted, we still can get 'false' from
             // array_search(). This is not a problem because we are
             // removing this identifier from anywhere.
             if (($key = array_search($entryIdentifier, $identifiers)) !== false) {
                 unset($identifiers[$key]);
                 if (count($identifiers)) {
                     $this->memcache->set($this->identifierPrefix . 'tag_' . $tag, $identifiers);
                 } else {
                     $this->removeTagsFromTagIndex(array($tag));
                     $this->memcache->delete($this->identifierPrefix . 'tag_' . $tag);
                 }
             }
         }
         // Clear reverse tag index for this identifier
         $this->memcache->delete($this->identifierPrefix . 'ident_' . $entryIdentifier);
     }
 }
Beispiel #23
0
 /**
  * Erase all cached entries
  */
 public function deleteAll()
 {
     $this->connect();
     $this->mem_cache_instace->delete($this->genKey());
     $this->disconnect();
     $this->deinit_internal_cache();
 }
Beispiel #24
0
 /**
  * Delete a cache entry based on id
  *     // Delete the 'foo' cache entry immediately
  *     Cache::instance('memcache')->delete('foo');
  *     // Delete the 'bar' cache entry after 30 seconds
  *     Cache::instance('memcache')->delete('bar', 30);
  * @param   string $id       id of entry to delete
  * @param   integer $timeout timeout of entry, if zero item is deleted immediately, otherwise the item will delete after the specified value in seconds
  * @return  boolean
  */
 public function delete($id, $timeout = 0)
 {
     // for ProfilerToolbar
     ProfilerToolbar::cacheLog('del', array_search($this, Cache::$instances), $id);
     // /for ProfilerToolbar
     // Delete the id
     return $this->_memcache->delete($this->_sanitize_id($id), $timeout);
 }
Beispiel #25
0
 /**
  *
  * @see Cache#delete($key)
  */
 public function delete($key)
 {
     if ($this->_memcache) {
         return $this->_memcache->delete($key);
     } else {
         return false;
     }
 }
Beispiel #26
0
 function delete($key)
 {
     $key = str_replace('\\', '/', $key);
     if (!$this->memcache->delete($key, 0)) {
         $message = sprintf('Memcache::delete() with key "%s" failed', $key);
         \ManiaLib\Utils\Logger::error($message);
     }
 }
Beispiel #27
0
 public function delete($key)
 {
     if (!isset($this->memcache)) {
         $this->connect();
     }
     $key = $this->prefix . $key;
     return $this->memcache->delete($key);
 }
Beispiel #28
0
 /**
  * Deletes an object from the cache
  */
 function delete($key)
 {
     if (!$this->enabled) {
         return false;
     }
     $this->memcache->delete($key);
     return true;
 }
Beispiel #29
0
 function _remove($key)
 {
     if (!self::$memcache_operational) {
         return;
     }
     $key = "{$this->_name}-{$key}";
     @self::$memcache->delete($key, 0);
 }
Beispiel #30
0
             }
         }
     }
 }
 /**
  * @param $key
  * @param $data
  * @param int $expire