Latest web development tutorials

Memcached delete command

Memcached delete command is used to delete an existing key (key).

grammar:

The basic syntax delete command is as follows:

delete key [noreply]

A plurality of key separated by a space, as follows:

gets key1 key2 key3

Parameters are as follows:

  • key: key key-value structure key, it is used to find the cache value.
  • noreply (optional): This parameter tells the server does not need to return data

Examples

In the following examples, we use w3big as the key, set the expiration time of 900 seconds. Then we use the delete command to delete the key.

set w3big 0 900 9
memcached
STORED
get w3big
VALUE w3big 0 9
memcached
END
delete w3big
DELETED
get w3big
END
delete w3big
NOT_FOUND

Export

Output information Description:

  • DELETED: deleted successfully.
  • ERROR: syntax error, or delete failed.
  • NOT_FOUND: key does not exist.