Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

memcached set not stored

enter image description here

The following step has followed:

telnet localhost 11211
set Test 0 100 10
get Test 
CLIENT_ERROR bad data chunk
ERROR
set amit 2 2 2 
get amit 
CLIENT_ERROR bad data chunk
ERROR
like image 653
Amit Bajaj Avatar asked Oct 20 '25 14:10

Amit Bajaj


2 Answers

In my case I was providing the value but the bytes were not exactly what I was mentioning in the set command, for the format of the command is:

set KEY META_DATA EXPIRY_TIME LENGTH_IN_BYTES

so for those who were just copy pasting the command without knowing as to why is it not storing the key and came here for the answer, this might help:

You need to provide the value of exactly the same bytes which you have mentioned in the last parameter of the set command

the following won't work:

enter image description here

also the following won't:

enter image description here

So when you enter the value it has to be exactly the same bytes, like this:

enter image description here

like image 138
shabby Avatar answered Oct 23 '25 07:10

shabby


Although you do not ask a specific question, i presume you want to store a value. You could test with the default example from the Memcached manual.

You define that you want to store a key, but don't specify a value.

The following example specifies that you want to save a key "tutorialspoint", no flags, timeout of 900 and reserve 9 bytes for a value. Those 9 bytes are specified in the next line: "memcached". In your example i don't see a value.

set tutorialspoint 0 900 9
memcached
STORED

get tutorialspoint
VALUE tutorialspoint 0 9
memcached

END
like image 27
phulstaert Avatar answered Oct 23 '25 07:10

phulstaert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!