• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getMemcacheStats函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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>
开发者ID:hartum,项目名称:basezf,代码行数:31,代码来源:memcache.php


示例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>
开发者ID:Shopatron,项目名称:mcrouter-util,代码行数:31,代码来源:memcache.php



注:本文中的getMemcacheStats函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getMenu函数代码示例发布时间:2022-05-15
下一篇:
PHP getMemberships函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap