Tuesday 23 August 2016

Memcached: Prepend data

‘prepend command is used to prepend new data to the existing data associated with given key.

Syntax
prepend key flags exptime bytes [noreply] value

Following table summarizes the arguments of append command.

Argument
Description
key
Name of the key.
flags
It is 32-bit unsigned integer, stored along with the data in the server and retrieved when you get the <key value> pair.
exptime
Expiry time of the data stored in cache. It is represented in seconds.
bytes
length of the data in bytes that needs to be stored in Memcached.
noreply
It is optional, when you pass this parameter, server don’t send any reply back to you.
value
Value to be appended in Memcached server.

Open new terminal and use telnet to connect to memcached server.
telnet <hostname> <port>


By default memcached server listen on port 11211.
$ telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
set 1 0 900 8
Tutorial
STORED
get 1
VALUE 1 0 8
Tutorial
END
prepend 1 0 900 5
Java 
STORED
get 1
VALUE 1 0 13
Java Tutorial
END



Previous                                                 Next                                                 Home

No comments:

Post a Comment