//查看缓存队列是否丢失
public function Memcachetest() {
$mCache = new CacheMemcache();
$allKeys = array();
$allItems = $mCache->getExtendedStats('items'); // 取得所有 item
foreach ($allItems as $tmpserver => $rows) {
foreach ($rows["items"] as $slabId => $v) { // 由 item 取得所有 slab id
echo "slab id: {$slabId} \n";
$cdump = $mCache->getExtendedStats('cachedump', $slabId); //由slab id取得所有cachedump
foreach ($cdump AS $server => $arrVal) { // 由 cachedump 取得所有 key
echo " server => {$server} \n";
if ($arrVal) {
foreach ($arrVal AS $key => $v) {
echo " key: {$key} \n";
$allKeys[$server][] = $key;
}
} else {
// 使用Memcache::addServer增加多個server到connection pool,才可能執行到這裡
echo " 此server無此slab id \n";
}
}
echo "\n";
}
}
}
}
public function Memcachetest() {
$mCache = new CacheMemcache();
$allKeys = array();
$allItems = $mCache->getExtendedStats('items'); // 取得所有 item
foreach ($allItems as $tmpserver => $rows) {
foreach ($rows["items"] as $slabId => $v) { // 由 item 取得所有 slab id
echo "slab id: {$slabId} \n";
$cdump = $mCache->getExtendedStats('cachedump', $slabId); //由slab id取得所有cachedump
foreach ($cdump AS $server => $arrVal) { // 由 cachedump 取得所有 key
echo " server => {$server} \n";
if ($arrVal) {
foreach ($arrVal AS $key => $v) {
echo " key: {$key} \n";
$allKeys[$server][] = $key;
}
} else {
// 使用Memcache::addServer增加多個server到connection pool,才可能執行到這裡
echo " 此server無此slab id \n";
}
}
echo "\n";
}
}
// 全部的 key
print_r($allKeys);
}
}