zoukankan      html  css  js  c++  java
  • php memcached-gui工具

    转载: https://github.com/mailopl/memcached-gui/blob/master/memcached.php

    适用于在服务端查看memcache内存数据

    php代码:

    <?php
    error_reporting(0);
    $memcache = new Memcache();
    $memcache->addServer('127.0.0.1'); // edit here if your memcached server differs from localhost
    $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,
                            'value' => $memcache->get($eName)
                        );
                    }
                }
            }
        }
    }
    ksort($list);
    if (isset($_GET['del'])) {
        $memcache->delete($_GET['del']);
        header("Location: " . $_SERVER['PHP_SELF']);
    }
    if (isset($_GET['flush'])) {
        $memcache->flush();
        header("Location: " . $_SERVER['PHP_SELF']);
    }
    if (isset($_GET['set'])) {
        $memcache->set($_GET['set'], $_GET['value']);
        header("Location: " . $_SERVER['PHP_SELF']);
    }
    ?>
    <head>
        <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
        <script type="text/javascript" src="http://cdn.bootcss.com/jquery/1.12.3/jquery.js"></script>
        <script type="text/javascript" src="http://cdn.bootcss.com/jquery.tablesorter/2.28.5/js/jquery.tablesorter.min.js"></script>
    
    </head>
    <body>
    
    <div class="container" style=" 940px;">
        <h3>memcached</h3>
        <table cellpadding="0" cellspacing="0" class="tablesorter table table-bordered table-hover table-striped">
            <thead>
            <tr>
                <th>key</th>
                <th>value</th>
            </tr>
            </thead>
            <tbody>
            <?php foreach($list as $i): ?>
                <tr>
                    <td><?php echo $i['key'] ?></td>
                    <td><?php echo $i['value'] ?></td>
                    <td><a href="memcached.php?del=<?php echo $i['key'] ?>">X</a>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
        <center>
            <a href="memcached.php?flush=1">FLUSH</a> <br />
            <br />
            <a href="#" onclick="memcachedSet()">SET</a>
        </center>
    
        <script type="text/javascript">
            $(document).ready(function(){
                $("table").tablesorter();
            });
            function memcachedSet() {
                key = prompt("Key: ");
                value = prompt("Value: ");
                window.location.href = "memcached.php?set="+ key +"&value=" + value;
            }
        </script>
    </body>

    效果:

    之前也用过fastonosql 非常好用,但可惜开始收费了。

    还有一个web管理软件:TreeSoft数据库管理系统

    http://www.treesoft.cn/dms.html

  • 相关阅读:
    当前毫秒时间戳
    生成随机指定长度的字符串
    symfony框架学习
    Git 学习一
    jmeter逻辑控制器
    jmeter执行顺序及作用域规则
    jmeter常用测试元件
    windows环境下jmeter生成测试报告
    jmeter参数化
    对网页进行截图(selenium)
  • 原文地址:https://www.cnblogs.com/dcb3688/p/4608029.html
Copyright © 2011-2022 走看看