YouTip LogoYouTip

Memcached Set Data

# Memcached set Command The Memcached set command is used to store a **value (data value)** in a specified **key**. If the key being set already exists, this command can update the original data associated with that key, thus performing an update function. ### Syntax: The basic syntax for the set command is as follows: set key flags exptime bytes value Parameter descriptions are as follows: * **key:** The key in the key-value structure, used to look up the cached value. * **flags:** An integer parameter that can include key-value pairs, used by the client to store additional information about the key-value pair. * **exptime:** The length of time (in seconds) to keep the key-value pair in the cache (0 means forever). * **bytes:** The number of bytes to store in the cache. * **noreply (optional):** This parameter tells the server not to return data. * **value:** The value to be stored (always on the second line) (can be understood directly as the value in the key-value structure). ### Example In the following example, we set: * key β†’ * flag β†’ 0 * exptime β†’ 900 (in seconds) * bytes β†’ 9 (number of bytes for data storage) * value β†’ memcached set 0 900 9 memcached STORED get VALUE 0 9 memcached END ### Output If the data is set successfully, the output is: STORED Output message explanation: * **STORED:** Output after successful save. * **ERROR:** Output after a failed save.
← Php ImagecharupPhp Imageaffinematrixconcat β†’