快速一键涮新多台memercach缓存

阅读更多

由于项目中存在多台memcached主备,每次刷新各自缓存时都比较麻烦只能一台一台telnet,甚是纠结,无意间接触到了window下的WScript.Shell,经过高人孙指点,上代码:

    在window系统下新建.vbs文件,将以下代码书写进去

set sh=WScript.CreateObject("WScript.Shell")
sh.Run "telnet 127.0.0.1 11211"
WScript.Sleep 500
sh.SendKeys "flush_all{ENTER}"
WScript.Sleep 500
sh.SendKeys "quit{ENTER}"
WScript.Sleep 1000
sh.Run "telnet 127.0.0.1 11212"
WScript.Sleep 500
sh.SendKeys "flush_all{ENTER}"
WScript.Sleep 500
sh.SendKeys "quit{ENTER}"
WScript.Sleep 1000
sh.Run "telnet 127.0.0.1 11213"
WScript.Sleep 500
sh.SendKeys "flush_all{ENTER}"
WScript.Sleep 500
sh.SendKeys "quit{ENTER}"
WScript.Sleep 500
SH.SendKeys"OK"

 在window下一键双击即可执行,同时刷新多台memercach缓存。只能在window下使用。

你可能感兴趣的:(WScript.Shell,memercach,快速,清空,多台)