php8.5
Home/ Manual/ memcached / memcached/ Memcached::delete

Memcached::delete

PHP function Edit on GitHub ✎

(PECL memcached >= 0.1.0)

Delete an item

Description

Memcached::delete(string $key, int $time = 0): bool

Delete the key from the server.

Parameters

key

The key to be deleted.

time

The amount of time the server will wait to delete the item.

Delete-time

Return Values

Success The Memcached::getResultCode will return Memcached::RES_NOTFOUND if the key does not exist.

Examples

Memcached::delete() example

php
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);

$m->delete('key1');
?>

See Also

  • Memcached::deleteByKey
  • Memcached::deleteMulti

Source: reference/memcached/memcached/delete.xml · from the official PHP manual (php/doc-en)