If you want to clear the items in memcache, what is the common method? Kill and restart? What if there are n memcaches that need to be restarted? Do it one by one?
It’s very simple. Assuming memcached is running on the local port 11211, then run the command line:
$ echo ”flush_all” | nc localhost 11211
Note: Flush does not delete items, it just marks all items as expired.
or
First, connection: telnet 127.0.0.1 11211
Second, press the Enter key
Third, flush_all and then press Enter
The console displays OK, indicating that the operation is successful
Description:
1. Clear all key values
flush_all
Note: Flush does not delete items, it just marks all items as expired, so memcache still occupies all memory at this time.
2. Exit
quit