Developer's Lab

By Diogo Pinto - DiØ

Flush Contents of a Memcached Server

The two ways following examples, show us how flush old data from memcached server through command line. We use netcat and telnet command to perform this job.

Using netcat Command

netcat command is a simple unix utility which reads and writes data across network connections, using TCP or UDP protocol. Below you can see how such commands works:

echo 'flush_all' | nc localhost 11211
or
echo 'flush_all' | netcat localhost 11211

another form way:

nc 192.168.1.10 11211<<<"flush_all"

with alias setting:

alias flush_mem_cache_server="echo 'flush_all' | netcat 127.0.0.1 11211"

Now, just you run the alias flush_mem_cache_server in your bash shell.

Using telnet Command

We can as well use the telnet protocol via default port(11211) from memcached server, typing flush_all. For example:

telnet 192.168.1.10 11211

then output will looks like:

Comments