Script listing all the keys on a memcache server March 21, 2013
Antre du Tryphon

Script listing all the keys on a memcache server

March 21, 2013 · Admin Ubuntu 11.10 Unix Ubuntu 11.04 Ubuntu Ubuntu 12.04 memcache

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]

Copyright 2012–2026, Claude "Tryphon" Théroux