Friday, June 4, 2010

Examples of Memcached telnet commands

I was looking for a example of a memcached telnet session, here is what I created. It shows the behavior of the set, get, add, gets, cas and replace commands.

I introduced the '>' sign before each input line to differentiate it from the output.

>add mykey 0 60 11
>hello world
STORED

>get mykey
hello world
END

>add mykey 0 60 11
>hello world
NOT_STORED

>replace mykey 0 60 7
>hello w
STORED

>get mykey
hello w
STORED

>replace newkey 0 60 7
>hello w
NOT_STORED

>get newkey
END

>set mykey 0 60 5
>hello
STORED

>set newkey 0 60 5
>hello
STORED

>gets newkey
VALUE newkey 0 5 999999
hello
END

>cas newkey 0 60 4 111111
>hola
EXISTS

>cas newkey 0 60 4 999999
>hola
STORED

4 comments:

Anonymous said...

Very nice examples

Anonymous said...

Very nice examples.

Grickit said...

Finally. A blog with actual examples instead of regurgitating and parroting the same documentation.

Thank you!

Kostas said...

Nice examples, but could you perhaps explain the numeric arguments to the commands like set?