Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Memcached add Command

Memcached add Command

The Memcached add command is used to store value (data value) in the specified key it.

If the key for add already exists, the data will not be updated (an expired key will be updated); the previous value will remain the same, and you will get the response NOT_STORED.

Syntax:

The basic syntax format of the add command is as follows:



add key flags exptime bytes [noreply]

value

The parameters are described as follows:

Example

In the following example we set:



add new_key 0 900 10

data_value

STORED

get new_key

VALUE new_key 0 10

data_value

END

Output

If the data is added successfully, it outputs:



STORED

Description of the output information: