手動清除memcached緩存方法


1.查memcache狀態
/usr/bin/perl /usr/local/src/memcached-1.4.5/scripts/memcached-tool localhost:11211
或者
telnet localhost 11211

2.手動清除memcached測試

 1). flush_all
  echo "flush_all" | nc localhost 11211

# telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
get var_key
VALUE var_key 0 13
test variable
END
flush_all
OK
get var_key
END
quit
Connection closed by foreign host.

 2). 重啟memcached進程
 kill $(ps aux|grep memcached|grep -v grep |awk '{print $2}')
/usr/local/memcached/bin/memcached -d -m 256 -p 11211 -u nobody

3)Memcache::flush() immediately invalidates all existing items.

/* procedural API */
$memcache_obj memcache_connect('memcache_host'11211);
memcache_flush($memcache_obj);
/* OO API */
$memcache_obj = new Memcache;
$memcache_obj->connect('memcache_host'11211);
$memcache_obj->flush();
?>

這個測試的表現是請求Memcache::flush()以后仍可以get $key取到值,而且通過memcached-tool 查到該item的max_age並無變化.

參考鏈接
MicrosoftInternetExplorer402DocumentNotSpecified7.8Normal0

理解 Memcache 的服務器端與客戶端

http://www.studyday.net/2011/07/261


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM