Created
July 18, 2011 19:26
-
-
Save munro/1090399 to your computer and use it in GitHub Desktop.
dump memcache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$memcache = new Memcache; | |
$memcache->connect("localhost", 11211); | |
$memcache->flush(); | |
$list = array(); | |
$allSlabs = $memcache->getExtendedStats('slabs'); | |
$items = $memcache->getExtendedStats('items'); | |
foreach($allSlabs as $server => $slabs) { | |
foreach($slabs AS $slabId => $slabMeta) { | |
$cdump = $memcache->getExtendedStats('cachedump',(int)$slabId); | |
foreach($cdump AS $server => $entries) { | |
if($entries) { | |
foreach($entries AS $eName => $eData) { | |
$list[$eName] = array( | |
'key' => $eName, | |
'server' => $server, | |
'slabId' => $slabId, | |
'detail' => $eData, | |
'age' => $items[$server]['items'][$slabId]['age'], | |
); | |
} | |
} | |
} | |
} | |
} | |
ksort($list); | |
print_r($list); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment