Skip to content

Instantly share code, notes, and snippets.

@jbraithwaite
Last active August 3, 2018 12:33
Show Gist options
  • Save jbraithwaite/39fb54c5456c8cef0504 to your computer and use it in GitHub Desktop.
Save jbraithwaite/39fb54c5456c8cef0504 to your computer and use it in GitHub Desktop.

Revisions

  1. jbraithwaite revised this gist May 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion memcached.php
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    <title>Memcached</title>
    <style type="text/css" media="screen">
    body {
    font-family: Consolass, "Lucida Console", Monaco, monospace;
    font-family: Consolas, "Lucida Console", Monaco, monospace;
    }

    table {
  2. jbraithwaite renamed this gist May 16, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. jbraithwaite created this gist May 16, 2014.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    ![Screenshot](http://i.imgur.com/ZguSTCw.png)
    90 changes: 90 additions & 0 deletions memcached.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,90 @@
    <html>
    <head>
    <title>Memcached</title>
    <style type="text/css" media="screen">
    body {
    font-family: Consolass, "Lucida Console", Monaco, monospace;
    }

    table {
    margin: 0 auto;
    width: 500px;
    }

    caption {
    font-size: 4em;
    padding: 20px 0;
    }

    td {
    padding: 5px;
    }

    tr td {
    text-align: right;
    }

    tr td:first-child {
    font-weight: bold;
    width: 100px;
    text-align: left;
    }

    tbody tr:nth-child(even) {
    background-color: #eee;
    }

    tr:hover {
    background-color: #298D84 !important;
    color: #fff;
    }

    thead {
    display: none;
    }

    table {
    border-collapse:collapse;
    }

    </style>
    </head>

    <body>

    <table>
    <caption>Memcached</caption>
    <thead>
    <tr>
    <th>Field</th>
    <th>Value</th>
    </tr>
    </thead>
    <tbody>

    <?php

    $m = new Memcached;
    $host = 'localhost';
    $port = 11211;

    $m->addServer($host, $port);

    $stats = $m->getstats()[$host.':' . $port];

    foreach($stats as $key => $value):

    ?>

    <tr>
    <td><?=$key?></td>
    <td><?=$value?></td>
    </tr>

    <? endforeach; ?>

    </tbody>
    </table>

    </body>
    </html>