Created
November 12, 2012 03:33
-
-
Save CrookedNumber/4057350 to your computer and use it in GitHub Desktop.
Drupal-focused memcache GUI
This file contains hidden or 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('127.0.0.1', 11211) | |
or die ("Could not connect to memcache server"); | |
$cells = ''; | |
$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 $keys => $arrVal) { | |
if (!is_array($arrVal)) continue; | |
foreach ($arrVal as $k => $v) { | |
$pieces = explode('-', $k); | |
$obj = $memcache->get($k); | |
$cid = $obj->cid; | |
$data = $obj->data; | |
$headers = $obj->headers; | |
$flushes = $obj->flushes; | |
$expire = $obj->expire; | |
$cells .= '<tr><td>' . urldecode(array_shift($pieces)) . '</td><td>' . $cid . '</td><td>' . print_r($data, 1) . '</td><td>' . $headers . '</td><td>' . $flushes . '</td><td>' . $expire . '</td></tr>'; | |
} | |
} | |
} | |
} | |
print "<table border='1'><tr><th>bin</th><th>cid</th><th>data</th><th>headers</th><th>flushes</th><th>expire</th></tr>$cells</table>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment