protected function dumpEntries($host, $port, $namespace = null, $flat = false)
{
// Assume empty result
$result = array();
$client = $this->getMemcachedClient($host, $port, $this->getConfig()->timeout);
// Fetch all keys and all values ...
$allSlabs = $client->stats(Client::STATS_TYPE_SLABS);
$items = $client->stats(Client::STATS_TYPE_ITEMS);
if (isset($slabs['active_slabs']) === true) {
unset($slabs['active_slabs']);
}
if (isset($slabs['total_malloced']) === true) {
unset($slabs['total_malloced']);
}
foreach ($allSlabs as $slabId => $slabMeta) {
$cachedump = $client->stats(Client::STATS_TYPE_CACHEDUMP, (int) $slabId, Client::CACHEDUMP_ITEMS_MAX);
foreach ($cachedump as $key => $value) {
if ($flat === true) {
$metaData = $client->gets(array($key), true);
$result[] = array('key' => $key, 'value' => $metaData[$key]['value'], 'cas' => $metaData[$key]['meta']['cas'], 'frames' => $metaData[$key]['meta']['frames'], 'flags' => $metaData[$key]['meta']['flags']);
} else {
$result[$key] = array('raw' => $value, 'value' => $client->gets(array($key)), 'server' => $host . ':' . $port, 'slabId' => $slabId, 'age' => $items['items'][$slabId]['age']);
}
}
}
return $result;
}