Memcached delete Command
The Memcached delete command is used to delete an already existing key.
Syntax:
The basic syntax format of the delete command is as follows:
delete key [noreply]
The parameters are described as follows:
- **key:** the key in the key-value structure, used to look up the cached value.
- noreply (optional): this parameter tells the server that it does not need to return data
Example
In the following example, we use runoob as the key with an expiration time of 900 seconds. Then we use the delete command to delete the key.
set runoob 0 900 9
memcached
STORED
get runoob
VALUE runoob 0 9
memcached
END
delete runoob
DELETED
get runoob
END
delete runoob
NOT_FOUND
Output
Description of the output information:
- DELETED: deletion successful.
- ERROR: syntax error or deletion failed.
- NOT_FOUND: the key does not exist.