memcached Telnet Interface
This is a short summary of everything important that helps to inspect a running memcached instance.
How To Connect
Use "ps -ef" to find out which IP and port was passed when memcached was started and use the same with telnet to connect to memcache. Example:
telnet 10.10.1.24 23456
Supported Commands
The supported commands (the official ones and some unofficial) are documented in the doc/protocol.txt document.
Sadly the syntax description isn't really clear and a simple help command listing the existing commands would be much better. Here is an overview of the commands you can find in the source (as of 16.12.2008):
Command
Description
Example
|
get | Reads a value | get mykey |
set | Set a key unconditionally | set mykey 0 60 5 |
add | Add a new key | add newkey 0 60 5 |
replace | Overwrite existing key | replace key 0 60 5 |
append | Append data to existing key | append key 0 60 15 |
prepend | Prepend data to existing key | prepend key 0 60 15 |
incr | Increments numerical key value by given number | incr mykey 2 |
decr | Decrements numerical key value by given number | decr mykey 5 |
delete | Deletes an existing key | delete mykey |
flush_all | Invalidate specific items immediately | flush_all |
Invalidate all items in n seconds | flush_all 900 |
stats | Prints general statistics | stats |
Prints memory statistics | stats slabs |
Prints memory statistics | stats malloc |
Print higher level allocation statistics | stats items |
| stats detail |
| stats sizes |
Resets statistics | stats reset |
version | Prints server version. | version |
verbosity | Increases log level | verbosity |
quit | Terminate telnet session | quit |