Memcached delete command
The Memcached delete command is used to delete an existing key.
Syntax:
The basic syntax format of delete command is as follows:
delete key [noreply]
Multiple keys are separated by spaces, as follows:
gets key1 key2 key3
Parameter description is as follows:
key: The key in the key-value structure is used to find cached values.
noreply (optional) : This parameter tells the server that there is no need to return data
Instance
In the following example, we use php as the key and the expiration time is set to 900 seconds. We then use the delete command to delete the key.
set php 0 900 9 memcached STORED get php VALUE php 0 9 memcached END delete php DELETED get php END delete php NOT_FOUND
Output
Output information description:
DELETED: Deletion successful.
ERROR: Syntax error or deletion failed.
NOT_FOUND: key does not exist.