Quick Command Line Method to Get Memcached Stats

I had to look for a while to figure this out:

echo stats | nc 127.0.0.1 11211

This assumes the memcached instance is running on a local instance with the standard port. This will output a bunch of statistics about the machine. The one to watch is “evictions,” which represent items getting overwritten before they naturally expired. This would indicate items being cached too long or the server running out of memory.