In Bash, you can check memcache statistics with this command:
exec 3<>/dev/tcp/localhost/11211; printf "stats\nquit\n" >&3; cat <&3
To clear the cache, use the memflush command:
echo flush_all >/dev/tcp/localhost/11211
and check if the statistics have increased.
To reset all cached objects, use memdump or memcdump (part of the memcached / libmemcached ):
memcdump --servers=localhost:11211
or:
memdump --servers=localhost:11211
If you use PHP to find out if it is supported check: php -i | grep memcached php -i | grep memcached php -i | grep memcached php -i | grep memcached .
trace
To check which particular memcached process is processing, you can use network sniffers or debuggers (for example, strace on Linux or dtrace / dtruss on Unix / OS X). Check out some examples below.
Strain
sudo strace -e read,write -fp $(pgrep memcached)
To better format the output, check: How to parse strace in a shell into plain text?
Dtruss
Dtruss is a dtrace shell available on Unix systems. Run this as:
sudo dtruss -t read -fp $(pgrep memcached)
Tcpdump
sudo tcpdump -i lo0 -s1500 -w- -ln port 11211 | strings -10
kenorb Apr 12 '16 at 17:18 2016-04-12 17:18
source share