軟件版本php
memcached-1.4.5 memcache-3.0.5 php-5.2.11
一、查 memcache 狀態bash
/usr/bin/perl /usr/local/src/memcached-1.4.5/scripts/memcached-tool localhost:11211 或者 telnet localhost 11211
二、手動清除 memcached 測試dom
1) flush_allmemcached
echo "flush_all" | nc localhost 11211 或者直接 telnet 到服務端 # 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) 測試ui
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 並沒有變化。spa