本文整理汇总了PHP中getMemcacheStats函数的典型用法代码示例。如果您正苦于以下问题:PHP getMemcacheStats函数的具体用法?PHP getMemcacheStats怎么用?PHP getMemcacheStats使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getMemcacheStats函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fill_box
fill_box($image, 30, $size, 50, -$hits * ($size - 21) / $total, $col_black, $col_green, sprintf("%.1f%%", $hits * 100 / $total));
fill_box($image, 130, $size, 50, -max(4, ($total - $hits) * ($size - 21) / $total), $col_black, $col_red, sprintf("%.1f%%", $misses * 100 / $total));
break;
}
header("Content-type: image/png");
imagepng($image);
exit;
}
echo getHeader();
echo getMenu();
switch ($_GET['op']) {
case 1:
// host stats
$phpversion = phpversion();
$memcacheStats = getMemcacheStats();
$memcacheStatsSingle = getMemcacheStats(false);
$mem_size = $memcacheStats['limit_maxbytes'];
$mem_used = $memcacheStats['bytes'];
$mem_avail = $mem_size - $mem_used;
$startTime = time() - array_sum($memcacheStats['uptime']);
$curr_items = $memcacheStats['curr_items'];
$total_items = $memcacheStats['total_items'];
$hits = $memcacheStats['get_hits'] == 0 ? 1 : $memcacheStats['get_hits'];
$misses = $memcacheStats['get_misses'] == 0 ? 1 : $memcacheStats['get_misses'];
$sets = $memcacheStats['cmd_set'];
$req_rate = sprintf("%.2f", ($hits + $misses) / ($time - $startTime));
$hit_rate = sprintf("%.2f", $hits / ($time - $startTime));
$miss_rate = sprintf("%.2f", $misses / ($time - $startTime));
$set_rate = sprintf("%.2f", $sets / ($time - $startTime));
echo <<<EOB
\t\t<div class="info div1"><h2>General Cache Information</h2>
示例2: flushStats
case 7:
// flush stats
$theserver = $MEMCACHE_SERVERS[(int) $_GET['server']];
$r = flushStats($theserver);
echo 'Stats reset ' . $theserver . " : " . print_r($r, true);
break;
case 8:
// variables
$m = 0;
$cacheItems = getCacheItems();
$slabInfo = getAllSlabStats();
$items = $cacheItems['items'];
$totals = $cacheItems['counts'];
$maxDump = MAX_ITEM_DUMP;
foreach ($items as $server => $entries) {
$memcacheStats = getMemcacheStats();
echo <<<EOB
\t\t\t<h3>{$server}</h3>
<table cellspacing=1 id="slabStats" class="tablesorter"><thead>
\t\t\t<tr>
<th class="vtip" title="Id of the slab">Id</th>
<th class="vtip" title="Current items count">Items</th>
<th class="vtip" title="The amount of space each chunk uses.<br>One item will use one chunk of the appropriate size">Chunk Size</th>
<th class="vtip" title="How many chunks exist within one page. A page by default is one megabyte in size.<br>Slabs are allocated per page, then broken into chunks">Chunks per page</th>
<th class="vtip" title="Total number of pages allocated to the slab class">Pages</th>
<th class="vtip" title="Total number of chunks allocated to the slab class">Total Chunks</th>
<th class="vtip" title="How many chunks have been allocated to items">Used Chunks</th>
<th class="vtip" title="Chunks not yet allocated to items, or freed via delete">Free Chunks</th>
<th class="vtip" title="How much memory is wasted because its not used by any item">Free Bytes</th>
<th class="vtip" title="% of total cache space (all memeory allocated by memcache) used by slabs of this class">% of space</th>