<div><h2>Memcache Server Information</h2>
EOB;
foreach($MEMCACHE_SERVERS as $server){
echo '<table cellspacing=0><tbody>';
echo '<tr><td>'.$server.'</td><td><a href="'https://www.linuxidc.com/Linux/2014-11/.$PHP_SELF.'&server='.array_search($server,$MEMCACHE_SERVERS).'&op=6">[<b>Flush this server</b>]</a></td></tr>';
echo '<tr><td>Start Time</td><td>',date(DATE_FORMAT,$memcacheStatsSingle[$server]['STAT']['time']-$memcacheStatsSingle[$server]['STAT']['uptime']),'</td></tr>';
echo '<tr><td>Uptime</td><td>',duration($memcacheStatsSingle[$server]['STAT']['time']-$memcacheStatsSingle[$server]['STAT']['uptime']),'</td></tr>';
echo '<tr><td>Memcached Server Version</td><td>'.$memcacheStatsSingle[$server]['STAT']['version'].'</td></tr>';
echo '<tr><td>Used Cache Size</td><td>',bsize($memcacheStatsSingle[$server]['STAT']['bytes']),'</td></tr>';
echo '<tr><td>Total Cache Size</td><td>',bsize($memcacheStatsSingle[$server]['STAT']['limit_maxbytes']),'</td></tr>';
echo '</tbody></table>';
}
echo <<<EOB
</div>
<div><h2>Host Status Diagrams</h2>
<table cellspacing=0><tbody>
EOB;
$size='width='.(GRAPH_SIZE+50).'<tr>'.
"<td><img alt=https://www.linuxidc.com/Linux/2014-11/\"https://www.linuxidc.com/Linux/2014-11/\" $size src=https://www.linuxidc.com/Linux/2014-11/\"$PHP_SELF&IMG=1&".(isset($_GET['singleout'])? 'singleout='.$_GET['singleout'].'&':'')."$time\"></td>".
"<td><img alt=https://www.linuxidc.com/Linux/2014-11/\"https://www.linuxidc.com/Linux/2014-11/\" $size src=https://www.linuxidc.com/Linux/2014-11/\"$PHP_SELF&IMG=2&".(isset($_GET['singleout'])? 'singleout='.$_GET['singleout'].'&':'')."$time\"></td></tr>\n"
: "",
'<tr>',
'<td><span> </span>Free: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"</td>\n",
'<td><span> </span>Hits: ',$hits.sprintf(" (%.1f%%)",$hits*100/($hits+$misses)),"</td>\n",
'</tr>',
'<tr>',
'<td><span> </span>Used: ',bsize($mem_used ).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"</td>\n",
'<td><span> </span>Misses: ',$misses.sprintf(" (%.1f%%)",$misses*100/($hits+$misses)),"</td>\n";
echo <<< EOB
</tr>
</tbody></table>
<br/>
<div><h2>Cache Information</h2>
<table cellspacing=0><tbody>
<tr><td>Current Items(total)</td><td>$curr_items ($total_items)</td></tr>
<tr><td>Hits</td><td>{$hits}</td></tr>
<tr><td>Misses</td><td>{$misses}</td></tr>
<tr><td>Request Rate (hits, misses)</td><td>$req_rate cache requests/second</td></tr>
<tr><td>Hit Rate</td><td>$hit_rate cache requests/second</td></tr>
<tr><td>Miss Rate</td><td>$miss_rate cache requests/second</td></tr>
<tr><td>Set Rate</td><td>$set_rate cache requests/second</td></tr>
</tbody></table>
</div>
EOB;
break;
case 2: // variables
$m=0;
$cacheItems= getCacheItems();
$items = $cacheItems['items'];
$totals = $cacheItems['counts'];
$maxDump = MAX_ITEM_DUMP;
foreach($items as $server => $entries) {
echo <<< EOB
<div><table cellspacing=0><tbody>
<tr><th colspan="2">$server</th></tr>
<tr><th>Slab Id</th><th>Info</th></tr>
EOB;