本文整理汇总了PHP中Memcached::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Memcached::delete方法的具体用法?PHP Memcached::delete怎么用?PHP Memcached::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Memcached
的用法示例。
在下文中一共展示了Memcached::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tsli_save_post
public function tsli_save_post($post_ID, $post, $update)
{
$memcache = new Memcached();
$memcache->addServer('127.0.0.1', 11211);
foreach ($post as $key => $value) {
$memcache->delete(md5(json_encode(array("field" => $key, "id" => $post_ID, "type" => "tsli"))));
$memcache->delete(md5(json_encode(array("field" => $key, "slug" => $post->post_name, "type" => "tsli"))));
}
$memcache->delete(md5(json_encode(array("type" => "tsli", "slug" => $post->post_name))));
$memcache->delete(md5(json_encode(array("type" => "tsli", "id" => $post_ID))));
}
示例2: delete
public function delete($key)
{
$key = $this->prefix . $key;
$this->store->delete($key);
$this->removeFromIndex($key);
return $this;
}
示例3: release
/**
* 解锁
* @param unknown $key
*/
public function release($key)
{
$key = $this->prefix . $key;
if ($this->memcached->get($key) === $this->Identifier) {
$this->memcached->delete($key);
}
}
示例4: Delete
/**
* Delete an item from the cache
*
* @param string $key cache key
*/
public function Delete($key)
{
if (empty($key)) {
return;
}
$this->memcache->delete($key);
}
示例5: invalidate
/**
* @param string $name
*/
public function invalidate($name)
{
if (!$this->memcached instanceof \Memcached) {
$this->connect();
}
$this->memcached->delete($name);
}
示例6: delete
function delete($key)
{
$key = str_replace('\\', '/', $key);
if (!$this->memcached->delete($key)) {
$message = sprintf('Memcache::delete() with key "%s" failed', $key);
\ManiaLib\Utils\Logger::error($message);
}
}
示例7: getCounter
public function getCounter()
{
$memcached = new \Memcached();
$memcached->addServer($GLOBALS['settings']['memcached']['host'], $GLOBALS['settings']['memcached']['port']);
$memcached->delete('prefix/counter/value');
$memcached->delete('prefix/counter/value2');
return new \Cachet\Counter\Memcache($memcached, 'prefix');
}
示例8: releaseLock
/**
* 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;
}
示例9: testLoadStatusEmpty
public function testLoadStatusEmpty()
{
$this->_connection->delete('EjsmontCircuitBreakerAAAbbb');
$this->assertEquals("", $this->_adapter->loadStatus('GGG', ''));
$this->assertEquals("", $this->_adapter->loadStatus('AAA', 'bbb'));
$this->_adapter->saveStatus('B', 'bbb', "");
$this->assertEquals("", $this->_adapter->loadStatus('A', 'bbb'), 6);
$this->assertEquals("", $this->_adapter->loadStatus('B', 'bbb'), 7);
}
示例10: deleteArrayDataFromStorage
/**
* {@inheritdoc}
*/
protected function deleteArrayDataFromStorage(array $keys)
{
$deleted = true;
foreach ($keys as $key) {
if ($this->memcached->delete($key) === false) {
$deleted = false;
}
}
return $deleted;
}
示例11: delete
public function delete($key)
{
$this->memcachedObj->delete($key);
$resultCode = $this->memcachedObj->getResultCode();
if ($resultCode != \Memcached::RES_SUCCESS && $resultCode != \Memcached::RES_NOTFOUND) {
throw new StorageException('[STORAGE] "' . $this->getStorageName() . '::delete" failed for key "' . $key . '"!' . ' StorageRespCode: ' . $resultCode);
}
unset($this->casArray[$key]);
return $resultCode;
}
示例12: doDelete
/**
* {@inheritdoc}
*/
protected function doDelete($key, array $options = array())
{
$this->client->delete($this->getKey($key, $options));
switch (true) {
case $this->isSuccess():
return new CacheResponse(true, true, true);
case $this->isNotFound():
return new CacheResponse(false, false, true, CacheResponse::RESOURCE_NOT_FOUND);
}
/* If everything failed we're dealing with a backend (connection) error. */
return new CacheResponse(false, false, false, CacheResponse::CONNECTION_ERROR);
}
示例13: process
public function process()
{
$id = $this->get('id');
$state = (string) $this->get('state');
if (!$this->is_moderator()) {
throw new ErrorApi(ErrorApi::INSUFFICIENT_RIGHTS);
}
if (empty($id) || empty($state)) {
throw new ErrorApi(ErrorApi::MISSING_INPUT);
}
$state = Meta::parse($state);
if (empty($state)) {
throw new ErrorApi(ErrorApi::INCORRECT_INPUT);
}
$this->db->update('art', array('sortdate' => $this->db->unix_to_date()), $id);
$this->remove_meta(Meta::ART, $id, Meta::STATE, Meta::STATE_APPROVED);
$this->remove_meta(Meta::ART, $id, Meta::STATE, Meta::STATE_UNAPPROVED);
$this->remove_meta(Meta::ART, $id, Meta::STATE, Meta::STATE_DISAPPROVED);
$this->remove_meta(Meta::ART, $id, Meta::STATE, Meta::STATE_DELETED);
$this->add_meta(Meta::ART, $id, Meta::STATE, $state);
$cache = new \Memcached("access_checker");
$cache->addServer("localhost", 11211);
$cache->delete('is_pic_safe_' . $this->db->get_field('art', 'md5', $id));
$this->set_success(true);
}
示例14: _doDelete
/**
* Remove a cache record directly. This method is implemented by the cache
* drivers and used in Doctrine_Cache_Driver::delete()
*
* @param string $id cache id
* @return boolean true if no problem
*/
protected function _doDelete($id)
{
if (false == $this->_memcached->getOption(Memcached::OPT_BINARY_PROTOCOL)) {
$id = str_replace(' ', '_', $id);
}
return $this->_memcached->delete($id);
}
示例15: delete
/**
* Delete data tied to a key on the cache server.
*
* @param string $key Key we can use to retrieve the data.
*
* @return bool True if deleted, false if not.
* @access public
*/
public function delete($key)
{
if ($this->connected === true && $this->ping() === true) {
return (bool) $this->server->delete($key);
}
return false;
}