Memcached Prepend Operation with Python Example


Prepend operation is simple and made on existing key-value. Newly provided value will be added at the beginning of existing value. Syntax is the same as other commands.

prepend key flags expiretime bytes
value
  • prepend the operation
  • key the key where its value will be prepended
  • flag  as you know
  • expiretime  how much time key-value will be hold
  • bytes the size of the value

Let’s add some data for start

add poftut 0 100 4 
test 
STORED

Now append more data please

prepend poftut 0 100 4 
neww 
STORED
  • prepend as we guess operation
  • poftut is existing key for prepend
  • flags,flags
  • 100 time to hold new key-value
  • prepended data size
  • neww  is prepended value
  • STORED means prepend is successfully complated

Check new value for poftut

get poftut 
VALUE poftut 0 8 
newwtest 
END

Python Application

LEARN MORE  Python Standard Library

Leave a Comment