This script lists all the keys on a memcache server.

#!/bin/bash
nc localhost 11211 > /tmp/$$.1 <<EOF
stats items
EOF
cut -d: -f2 /tmp/$$.1 | grep -v END | uniq  | sed 's/^/stats cachedump /' \ 
   | sed 's/$/ 1000/' > /tmp/$$.2
nc localhost 11211 < /tmp/$$.2 | grep -v '^END' | sort 
rm /tmp/$$.[12]