Memcached comma...login
Memcached command operation manual
author:php.cn  update time:2022-04-13 17:53:40

Memcached append command


The Memcached append command is used to append data to the value(data value) that already exists key(key).

Syntax:

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

append key flags exptime bytes [noreply]
value

The parameter description is as follows:

  • key: The key in the key-value structure is used to find cached values.

  • flags: Integer parameter that can include key-value pairs and is used by the client to store additional information about the key-value pairs .

  • exptime: The length of time to keep key-value pairs in the cache (in seconds, 0 means forever)

  • bytes: The number of bytes stored in the cache

  • noreply (optional) : This parameter tells the server that no data needs to be returned

  • value: The stored value (always located in the second line) (can be directly understood as the value in the key-value structure)

Example

The example is as follows:

  • First we store a key php in Memcached, and its value is memcached.

  • We then retrieve the value using the get command.

  • Then, we use the append command to append "redis" after the value with the key php.

  • Finally, we use the get command to retrieve the value.

set php 0 900 9
memcached
STORED
get php
VALUE php 0 14
memcached
END
append php 0 900 5
redis
STORED
get php
VALUE php 0 14
memcachedredis
END

Output

If the data is added successfully, output:

STORED

Output information description:

  • STORED: Output after successful saving.

  • NOT_STORED: The key does not exist on Memcached.

  • CLIENT_ERROR: Execution error.

php.cn