how to restart/clear memcache without restarting the whole web server?

yes. you can clear the memcache. try:

telnet localhost 11211
flush_all
quit

if the memcache does not run on localhost 11211, you will have to adjust it.


This will also work using netcat

echo "flush_all" | nc -q 2 localhost 11211 

Then just wait for the "OK".


memcflush in the memcache tools is what you want:

memcflush --servers=localhost:11211

Change localhost to whatever your server is.

The memcache tools may not be installed on the server, if you're running a Debian-based OS you can install it like this:

sudo apt-get install libmemcached-tools

In Bash you may use this fancy syntax:

echo flush_all > /dev/tcp/localhost/11211

Otherwise use memflush command:

memflush --servers=localhost