Skip to content

Instantly share code, notes, and snippets.

@Xion
Created September 20, 2015 03:14
Show Gist options
  • Save Xion/624979b05e0411324eb1 to your computer and use it in GitHub Desktop.
Save Xion/624979b05e0411324eb1 to your computer and use it in GitHub Desktop.
Flush all keys from memcached server
#!/usr/bin/expect --
# Purge local memcache, flushing all the keys & values
set escapechar !; # easier to send than default ^]
set host [lindex $argv 1];
if { ![string length $host] } {
set host "localhost";
}
set port [lindex $argv 2];
if { ![string length $port] } {
set port "11211";
}
spawn telnet -e $escapechar "$host" $port;
expect "Connected to $host";
send "flush_all\n";
send $escapechar;
expect "telnet>";
send "quit\n";
wait;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment