Testing memcached with telnetEdit

Start up a server on the localhost listening to some arbitrary port:

memcached -l -p 12345 -m 64 -vv

The -m 64 switch is really just there for explicitness, seeing as memcached defaults to using 64MB of memory by default anyway.

-vv turns on verbose logging so that we can see what’s happening.

If the -p switch is omitted memcached will use the default port of 11211.

Now from another console login via telnet:

telnet localhost 12345

We can issue get commands:

get greeting

So nothing was found. Now let’s store something:

set greeting 1 0 11
Hello world

That means, "use key greeting, use 1 as flag (arbitrary metadata), use 0 as the expiry (ie. never expire), and expect the value to be 11 bytes long".

Now we can get the value back out:

get greeting
VALUE greeting 1 11
Hello world

And we’re done:


Other commands

stats items
stats slabs

For a full list, see http://lzone.de/articles/memcached.htm