<?php $memcache = new Memcache(); $memcache->connect('localhost', 11211); $version = $memcache->getVersion(); echo "Server's version: " . $version . "\n"; print_r($memcache->getStats());
public function __construct() { $this->connect(); // Get keys (this code comes from Doctrine 2 project) $this->keys = array(); $servers = self::getMemcachedServers(); if (is_array($servers) && count($servers) > 0 && method_exists('Memcache', 'getStats')) { $all_slabs = $this->memcache->getStats('slabs'); } if (isset($all_slabs) && is_array($all_slabs)) { foreach ($all_slabs as $server => $slabs) { if (is_array($slabs)) { foreach (array_keys($slabs) as $slab_id) { if (is_int($slab_id)) { $dump = $this->memcache->getStats('cachedump', (int) $slab_id); if ($dump) { foreach ($dump as $entries) { if ($entries) { $this->keys = array_merge($this->keys, array_keys($entries)); } } } } } } } } }
/** * @inheritdoc */ public function status() { $stats = $this->memcache->getStats(); $status[self::HITS] = isset($stats['get_hits']) ? $stats['get_hits'] : 0; $status[self::MISSES] = isset($stats['get_misses']) ? $stats['get_misses'] : 0; $status[self::START_TIME] = isset($stats['uptime']) ? $stats['uptime'] : 0; $status[self::MEMORY_USED] = isset($stats['bytes']) ? $stats['bytes'] : 0; $status[self::MEMORY_LEFT] = isset($stats['limit_maxbytes']) ? $stats['limit_maxbytes'] : 0; return $status; }
/** * Determine the maximum size for cache data to be written */ private function max_packet_size() { if ($this->max_packet < 0) { $this->max_packet = 2097152; // default/max is 2 MB if ($this->type == 'db') { if ($value = $this->db->get_variable('max_allowed_packet', $this->max_packet)) { $this->max_packet = $value; } $this->max_packet -= 2000; } else { if ($this->type == 'memcache') { $stats = $this->db->getStats(); $remaining = $stats['limit_maxbytes'] - $stats['bytes']; $this->max_packet = min($remaining / 5, $this->max_packet); } else { if ($this->type == 'apc' && function_exists('apc_sma_info')) { $stats = apc_sma_info(); $this->max_packet = min($stats['avail_mem'] / 5, $this->max_packet); } } } } return $this->max_packet; }
/** * @throws \envtesting\Error */ public function connect() { if (!extension_loaded('memcache')) { throw new \envtesting\Error('PHP extension \'memcache\' is not loaded'); } if (!class_exists('Memcache')) { throw new \envtesting\Error('Memcache classs is missing.'); } try { $this->memcache = new \Memcache(); $this->memcache->connect($this->host, $this->port, true); if ($this->memcache->getStats() == false) { throw new \Exception('Memcache status return false.'); } } catch (\Exception $e) { throw new \envtesting\Error('Memcached connection faild: ' . $this->host . ':' . $this->port . ' : ' . $e->getMessage()); } }
public function get_statistics() { $a = $this->_memcache->getStats(); if (count($a) > 0) { $keys = array_keys($a); $key = $keys[0]; return $a[$key]; } return $a; }
/** * Get stats about cluster * * @param bool $extended detailed stats? * @return mixed - array on success; false on failure **/ public function stats($extended = true) { if ($this->open()) { if ($extended) { return $this->memcache->getExtendedStats(); } else { return $this->memcache->getStats(); } } return false; }
/** * 检查连接状态 * @return boolean */ public function checkDriver() { if (!$this->isConnected && $this->reConnected < $this->maxReConnected) { if ($this->handler->getStats() !== false) { $this->isConnected = true; } else { $this->initServers(); } if (!$this->isConnected) { $this->reConnected++; } else { $this->reConnected = 0; } } return $this->isConnected; }
function get_online_objects() { $device_browser_list = mmc_array_values(NS_DEVICE_LIST); time_print('性能分析:取列表:'); if (isset($_GET['debug'])) { $device_count = mmc_array_length(NS_DEVICE_LIST); $memcache_obj = new Memcache(); $memcache_obj->connect(MEMC_HOST, MEMC_PORT); $stats = $memcache_obj->getStats(); $memcache_obj->close(); $dbg_print = '开始时间:' . getDateStyle($stats['time'] - $stats['uptime']); $dbg_print .= ' 使用内存: ' . bytesToSize($stats['bytes']) . '/' . bytesToSize($stats['limit_maxbytes']); $dbg_print .= '<br>清理时间:' . getDateStyle(async_timer('/on_timer_online_list.php')); $dbg_print .= ' 维护设备数: ' . $device_count . ' 活跃设备数: ' . count($device_browser_list); $xmlStr = file_get_contents('http://' . $_SERVER['SERVER_NAME'] . '/channels-stats'); $channels = json_decode($xmlStr); $dbg_print .= '<br>推送开始:' . getDateStyle(time() - $channels->uptime) . ' 频道数: ' . $channels->channels; $dbg_print .= ' 订阅数: ' . $channels->subscribers . ' 消息数: ' . $channels->published_messages; $dbg_print .= '<br>流程计数: ' . counter() . '<br>'; echo $dbg_print; } /****************************************************** 预处理:账户绑定列表 ******************************************************/ $aDataSet = []; foreach ($device_browser_list as $browser) { if (empty($browser)) { continue; } $account = @$browser['bind_account']; $device = $browser['device']; $useragent = $browser['UserAgent']; $ref_obj = $browser['Visiting'] ? parse_url($browser['Visiting']) : null; $visiting = @$ref_obj['host']; $is_mobile = $browser['ismobiledevice'] ? 'mobi' : 'desk'; $aDataSet[] = [$account, $browser['region'], $visiting, $browser['browser'], $browser['platform'], $is_mobile, $browser['device_name'], $browser['device']]; } time_print('整合:'); if (isset($_GET['debug'])) { echo time_print(); } return $aDataSet; }
/** * Delete one or several data from cache (* joker can be used, but avoid it !) * E.g.: delete('*'); delete('my_prefix_*'); delete('my_key_name'); * * @param string $key * @return bool */ public function delete($key) { if ($key == '*') { $this->flush(); } elseif (strpos($key, '*') === false) { $this->_delete($key); } else { // Get keys (this code comes from Doctrine 2 project) $pattern = str_replace('\\*', '.*', preg_quote($key)); $servers = $this->getMemcachedServers(); if (is_array($servers) && count($servers) > 0 && method_exists('Memcache', 'getStats')) { $all_slabs = $this->memcache->getStats('slabs'); } if (isset($all_slabs) && is_array($all_slabs)) { foreach ($all_slabs as $server => $slabs) { if (is_array($slabs)) { foreach (array_keys($slabs) as $i => $slab_id) { // $slab_id is not an int but a string, using the key instead ? if (is_int($i)) { $dump = $this->memcache->getStats('cachedump', (int) $i); if ($dump) { foreach ($dump as $entries) { if ($entries) { foreach ($entries as $key => $data) { if (preg_match('#^' . $pattern . '$#', $key)) { $this->_delete($key); } } } } } } } } } } } return true; }
function GetStatus($id) { $arStats = array(); $arServer = CClusterMemcache::GetByID($id); if (is_array($arServer)) { $ob = new Memcache(); if (@$ob->connect($arServer["HOST"], $arServer["PORT"])) { $arStats = array('uptime' => null, 'version' => null, 'cmd_get' => null, 'cmd_set' => null, 'get_misses' => null, 'get_hits' => null, 'limit_maxbytes' => null, 'bytes' => null, 'curr_items' => null, 'listen_disabled_num' => null); $ar = $ob->getStats(); foreach ($arStats as $key => $value) { $arStats[$key] = $ar[$key]; } } } return $arStats; }
} if ($mesg) print '<br>' . $mesg; if (!empty($conf->memcached->host)) { $tmparray = explode(':', $conf->memcached->host); $server = $tmparray[0]; $port = $tmparray[1] ? $tmparray[1] : 11211; //dol_syslog("Try to connect to server " . $server . " port " . $port . " with class " . get_class($m)); $result = $m->addServer($server, $port); //$m->setOption(Memcached::OPT_COMPRESSION, false); //print "xxx".$result; // Read cache $arraycache = $m->getStats(); //var_dump($arraycache); } // Action print '<div class="tabsAction">'; print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=clear">' . $langs->trans("FlushCache") . '</a>'; print '</div>'; print '<br>'; // Statistics of cache server print '<table class="noborder" width="60%">'; print '<tr class="liste_titre"><td colspan="2">' . $langs->trans("Status") . '</td></tr>'; if (empty($conf->memcached->host)) {
<?php // // apt-get install php5-memcache // $memcache_enabled = extension_loaded("memcache"); if ($memcache_enabled) { echo "extension loaded"; } else { echo "extension not loaded"; } $mc = new Memcache(); $mc->connect("localhost", 11211); print_r($mc->getStats());
function memCache2html() { $html = ''; if (!class_exists('Memcache')) { return ''; } $cache = new Memcache(); $cache->connect('127.0.0.1', 11211); if ($res = $cache->getstats('items') and !empty($res['items'])) { if (MEMCACHE_CRYPT) { return '<b>Memcache</b>: Для отображения таблицы, отключите шифрование кэша в sys/config.php <b>MEMCACHE_CRYPT</b>'; } $html .= '<b>Memcache</b>. В целях безопасности включите шифрование кэша в sys/config.php <b>MEMCACHE_CRYPT</b>. <style type="text/css"> table.sys th{background-color: #9999ff; padding:7px; text-align: center;} table.sys td{background-color: #ccccff; padding:7px; text-align: center;white-space:pre} table.sys td.left{text-align: left;} .red{color:red;} </style><table class="sys" style="width:100%;"> <tr><th style="width:50px;">№</th><th>Ключ</th><th>Значение</th><th>Время жизни</th><th><a href="' . H . '/panel/settings/memcache_table_off" title="Закрыть таблицу" class="red">[X]</a></th></tr>'; $i = 0; foreach ($res['items'] as $key => $val) { $items = $cache->getStats('cachedump', $key); foreach ($items as $key => $val) { $i++; $live_time = $val[1] - TIME; if ($live_time < 0) { $live_time = 'Вечная'; } else { $live_time .= ' сек.'; } $html .= '<tr><td>' . $i . '</td><td>' . $key . '</td> <td class="left">' . htmlspecialchars(print_r($cache->get($key), true)) . '</td> <td>' . $live_time . '</td><td><a class="red" title="Удалить" href="' . H . '/panel/settings/del_memcached/' . $key . '">[X]</a></td></tr>'; } } $html .= '</table>'; } return $html; }
<?php $server_ip = 'localhost'; $server_port = '11211'; $load = extension_loaded('memcache'); if (!$load) { echo "The Memcache isn't loaded."; } else { $mem = new Memcache(); $mem->addServer($server_ip, $server_port); $status = $mem->getStats(); $foundCache = (double) $status["get_hits"] / (double) $status["cmd_get"] * 100; $foundCache = round($foundCache, 3); $cacheMiss = 100 - $foundCache; $read = (double) $status["bytes_read"] / (1024 * 1024); $write = (double) $status["bytes_written"] / (1024 * 1024); $totalSize = (double) $status["limit_maxbytes"] / (1024 * 1024); echo "<table border='1'>"; echo "<tr><td>Memcache version:</td><td> " . $status["version"] . "</td></tr>"; echo "<tr><td>Host: </td><td> " . $_SERVER["HTTP_HOST"] . "</td></tr>"; echo "<tr><td>Port: </td><td> " . $server_port . "</td></tr>"; echo "<tr><td>Process id </td><td>" . $status["pid"] . "</td></tr>"; echo "<tr><td>Running time </td><td>" . floor($status["uptime"] / 60) . " min</td></tr>"; echo "<tr><td>Accumulated user time by process </td><td>" . $status["rusage_user"] . " seconds</td></tr>"; echo "<tr><td>Accumulated system time for this process </td><td>" . $status["rusage_system"] . " seconds</td></tr>"; echo "<tr><td>Items stored by this server ever since it started </td><td>" . $status["total_items"] . "</td></tr>"; echo "<tr><td>Open connections </td><td>" . $status["curr_connections"] . "</td></tr>"; echo "<tr><td>All connections opened since the server started </td><td>" . $status["total_connections"] . "</td></tr>"; echo "<tr><td>Number of connection structures allocated by the server </td><td>" . $status["connection_structures"] . "</td></tr>"; echo "<tr><td>Cumulative number for get requests </td><td>" . $status["cmd_get"] . "</td></tr>"; echo "<tr><td> Cumulative number for storage requests </td><td>" . $status["cmd_set"] . "</td></tr>";
/** * @return array */ protected function _getStats() { return $this->_connection->getStats(); }
public function manager() { global $_REAL_POST; if ($_REAL_POST['purge']) { $ip = array_keys($_REAL_POST['purge']); $purge = $this->purge($ip[0]); \debug($purge); } if ($_REAL_POST['view']) { $host = array_keys($_REAL_POST['view']); $view = new \stdClass(); $view->server = $host[0]; $view->data = $this->get_data(500, $host[0]); } $servers = array(); foreach ($this->memcached_servers as $memcached_server) { $server = new \stdClass(); $server->host = $memcached_server; $server->port = '11211'; $server->status = $this->check_status($server->host, $server->port) ? "Online" : "Offline"; if ($server->status == "Online") { $mem = new \Memcache(); $mem->addServer($memcached_server, '11211'); $stats = $mem->getStats(); } else { $stats = NULL; } //the overview stats we are interested in $hit_rate = @((double) $stats["get_hits"] / (double) $stats["cmd_get"] * 100); $hit_rate = number_format(round($hit_rate, 3)); $miss_rate = number_format(100 - $hit_rate); $server->hits = $stats['get_hits']; $server->hitrate = $hit_rate; $server->missrate = $miss_rate; $server->misses = $stats['get_misses']; $server->connections = $stats['total_connections']; $server->objects = $stats['total_items']; $uptime = (int) $stats['uptime']; $server->uptime = number_format($uptime / 3600, 2) . ' hours'; $server->size = (double) $stats["limit_maxbytes"] / (1024 * 1024) . " MB"; $server->gets = $stats['cmd_get']; $server->sets = $stats['cmd_set']; $server->evictions = $stats['evictions']; $servers[] = $server; } //include html needed to show the page include Plugin::instance()->get_plugin_path() . '/includes/cache-manager.php'; }
$a[$i] = array($r['day'], $r['count']); } for ($i = 0; $i < 12; $i++) { print '<tr>'; print '<th>' . $a[$i][0] . ':</th><td>' . number_format($a[$i][1], 0) . ' ' . _('posts') . ' ' . sprintf("(%0.1f%%)", $a[$i][1] / $totalposts * 100) . '</td>'; print '<th>' . $a[$i + 12][0] . ':</th><td>' . number_format($a[$i + 12][1], 0) . ' ' . _('posts') . ' ' . sprintf("(%0.1f%%)", $a[$i + 12][1] / $totalposts * 100) . '</td>'; print '</tr>'; } print '</table></td><td style="text-align:right"><img src="/stat-img-hour.php" width="400" height="250" /></td></tr></table>'; $cache1 = new Memcache(); $cache1->pconnect('localhost', '11211'); $cache2 = new Memcache(); $cache2->pconnect('localhost', '11212'); $dur = new Duration(); $cs1 = $cache1->getStats(); $cs2 = $cache2->getStats(); makeSection(_('cache statistics')); print '<table style="text-align:left"><tr><th>Statistic</th><th>Cache 1</th><th>Cache 2</th>'; print '<tr><th>Uptime</th><td>' . $dur->AgeAsString($cs1['uptime']) . '</td><td>' . $dur->AgeAsString($cs2['uptime']) . '</td></tr>'; print '<tr><th>Item Count</th><td>' . number_format($cs1['curr_items'], 0) . '</td><td>' . number_format($cs2['curr_items'], 0) . '</td></tr>'; print '<tr><th>Utilization</th><td>' . sprintf("%0.01f", $cs1['bytes'] / $cs1['limit_maxbytes'] * 100.0) . '%</td><td>' . sprintf("%0.01f", $cs2['bytes'] / $cs2['limit_maxbytes'] * 100.0) . '%</td></tr>'; print '<tr><th>Hit Efficiency</th><td>' . sprintf("%0.01f", $cs1['get_hits'] / $cs1['get_misses']) . " to 1 (" . sprintf("%0.02f", ($cs1['cmd_get'] + $cs1['cmd_set']) / $cs1['uptime']) . " req/s)</td><td>" . sprintf("%0.01f", $cs2['get_hits'] / $cs2['get_misses']) . ' to 1 (' . sprintf("%0.02f", ($cs2['cmd_get'] + $cs2['cmd_set']) / $cs2['uptime']) . ' req/s)</td></tr>'; print '<tr><th>Byte Efficiency</th><td>' . sprintf("%0.01f", $cs1['bytes_written'] / $cs1['bytes_read']) . " to 1</td><td>" . sprintf("%0.01f", $cs2['bytes_written'] / $cs2['bytes_read']) . ' to 1</td></tr>'; print '<tr><th>Average Object Size</th><td>' . number_format($cs1['bytes'] / $cs1['curr_items'], 0) . ' bytes</td><td>' . number_format($cs2['bytes'] / $cs2['curr_items'], 0) . ' bytes</td></tr>'; print '</table>'; $res = cache_pg_Exec($db, "SELECT COUNT(*) AS count,MAX(period) AS max_period,AVG(period) AS avg_period,SUM(hits) AS hits,MAX(hits) AS max_hits FROM spammers", 60); $res = $res[0]; makeSection(_('spammer statistics')); print '<table style="text-align:left">'; print '<tr><th>Active Spammer Count:</th><td>' . number_format($res['count']) . '</td></tr>'; print '<tr><th>Denied Spammer Requests:</th><td>' . number_format($res['hits']) . '</td></tr>';
public function Stats() { if ($this->status) { return parent::getStats(); } else { return array(); } }
<?php $memcache = new Memcache(); $host = '127.0.0.1'; $port = '11211'; $memcache->connect($host, $port); $memcache->set('class_name', '1', 0, 3600); $memcache->increment('class_name', '2'); $result = $memcache->get('class_name'); $stats = $memcache->getStats(); var_dump($stats); $memcache->flush(); $memcache->close();
public function stats() { return $this->memcache->getStats(); }
/** * Method to process actions to be taken * * @param string $action String indicating action to be taken */ public function dispatch($action = Null) { switch ($action) { default: // get the cache config file $filename = 'cache.config'; if (!file_exists($filename)) { touch($filename); chmod($filename, 0777); } $handle = fopen($filename, "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); //echo $num; for ($c = 0; $c < $num; $c++) { $cache[] = array('ip' => $data[0], 'port' => $data[1]); } } fclose($handle); if (empty($cache)) { $cachenew = array('ip' => 'localhost', 'port' => 11211); $cacherec = array($cachenew); $handle = fopen($filename, 'wb'); foreach ($cacherec as $rec) { fputcsv($handle, $rec); } fclose($handle); } $this->setVarByRef('cache', $cache); return 'edit_tpl.php'; break; case 'addserver': $ip = $this->getParam('ip'); $port = $this->getParam('port'); $filename = 'cache.config'; $handle = fopen($filename, "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $cache[] = array('ip' => $data[0], 'port' => $data[1]); } fclose($handle); $adder = array(array('ip' => $ip, 'port' => $port)); $all = array_merge($adder, $cache); // re-write the cache config file unlink($filename); $filename2 = 'cache.config'; $handle = fopen($filename2, 'wb'); foreach ($all as $servers) { fputcsv($handle, $servers); } fclose($handle); $this->setVarByRef('cache', $all); return 'edit_tpl.php'; case 'displaystats': $filename = 'cache.config'; $handle = fopen($filename, "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $cache[] = array('ip' => $data[0], 'port' => $data[1]); } fclose($handle); $id = $this->getParam('id'); $machine = explode(":", $id); $memcache = new Memcache(); $memcache->addServer($machine[0], $machine[1]); $stats = $memcache->getStats(); $this->setVarByRef('stats', $stats); $this->setVarByRef('cache', $cache); $this->setVarByRef('machine', $machine); return 'edit_tpl.php'; break; } }
/** * Pobranie statystyk memcached * @return array */ public function getStatistics() { return $this->memcached->getStats(); }
public function get_statistics() { return $this->_memcache->getStats(); }
/** * @param array $option * @return array */ public function driver_stats($option = array()) { $this->connectServer(); $res = array('info' => '', 'size' => '', 'data' => $this->instant->getStats()); return $res; }
/** * @inheritdoc */ public function info() { return $this->driver->getStats(); }
/** * 获取Memcache的状态 */ public function stats() { $this->connection->getStats(); return; }
function get_memcachedinfo() { global $text_direction; echo '<div class="wrap" id="memcachedinfo" style="display: none;">' . "\n"; if (class_exists('Memcache')) { $memcached_obj = new Memcache(); $memcached_obj->addServer('localhost', 11211); $memcachedinfo = $memcached_obj->getStats(); if ('rtl' == $text_direction) { ?> <style type="text/css"> #memcachedinfo, #memcachedinfo table, #memcachedinfo th, #memcachedinfo td { direction: ltr; text-align: left; } #memcachedinfo h2 { padding: 0.5em 0 0; } </style> <?php } screen_icon(); echo "<h2>memcached {$memcachedinfo['version']}</h2>\n"; serverinfo_subnavi(); if ($memcachedinfo) { $cache_hit = $memcachedinfo['get_hits'] / $memcachedinfo['cmd_get'] * 100; $cache_hit = round($cache_hit, 2); $cache_miss = 100 - $cache_hit; $usage = round($memcachedinfo['bytes'] / $memcachedinfo['limit_maxbytes'] * 100, 2); $uptime = number_format_i18n($memcachedinfo['uptime'] / 60 / 60 / 24); echo '<br class="clear" />' . "\n"; echo '<table class="widefat" dir="ltr">' . "\n"; echo '<thead><tr><th>' . __('Variable Name', 'wp-serverinfo') . '</th><th>' . __('Value', 'wp-serverinfo') . '</th><th>' . __('Description', 'wp-serverinfo') . '</th></tr></thead><tbody>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>pid</td><td>' . $memcachedinfo['pid'] . '</td><td>' . __('Process ID', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>uptime</td><td>' . $uptime . '</td><td>' . __('Number of days since the process was started', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>version</td><td>' . $memcachedinfo['version'] . '</td><td>' . __('memcached version', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>rusage_user</td><td>' . $memcachedinfo['rusage_user'] . '</td><td>' . __('Seconds the cpu has devoted to the process as the user', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>rusage_system</td><td>' . $memcachedinfo['rusage_system'] . '</td><td>' . __('Seconds the cpu has devoted to the process as the system', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>curr_items</td><td>' . number_format_i18n($memcachedinfo['curr_items']) . '</td><td>' . __('Total number of items currently in memcached', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>total_items</td><td>' . number_format_i18n($memcachedinfo['total_items']) . '</td><td>' . __('Total number of items that have passed through memcached', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>bytes</td><td>' . format_filesize($memcachedinfo['bytes']) . ' (' . $usage . '%)</td><td>' . __('Memory size currently used by curr_items', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>limit_maxbytes</td><td>' . format_filesize($memcachedinfo['limit_maxbytes']) . '</td><td>' . __('Maximum memory size allocated to memcached', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>curr_connections</td><td>' . number_format_i18n($memcachedinfo['curr_connections']) . '</td><td>' . __('Total number of open connections to memcached', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>total_connections</td><td>' . number_format_i18n($memcachedinfo['total_connections']) . '</td><td>' . __('Total number of connections opened since memcached started running', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>connection_structures</td><td>' . number_format_i18n($memcachedinfo['connection_structures']) . '</td><td>' . __('Number of connection structures allocated by the server', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>cmd_get</td><td>' . number_format_i18n($memcachedinfo['cmd_get']) . '</td><td>' . __('Total GET commands issued to the server', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>cmd_set</td><td>' . number_format_i18n($memcachedinfo['cmd_set']) . '</td><td>' . __('Total SET commands issued to the server', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>cmd_flush</td><td>' . number_format_i18n($memcachedinfo['cmd_flush']) . '</td><td>' . __('Total FLUSH commands issued to the server', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>get_hits</td><td>' . number_format_i18n($memcachedinfo['get_hits']) . ' (' . $cache_hit . '%)</td><td>' . __('Total number of times a GET command was able to retrieve and return data', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>get_misses</td><td>' . number_format_i18n($memcachedinfo['get_misses']) . ' (' . $cache_miss . '%)</td><td>' . __('Total number of times a GET command was unable to retrieve and return data', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>delete_hits</td><td>' . number_format_i18n($memcachedinfo['delete_hits']) . '</td><td>' . __('Total number of times a DELETE command was able to delete data', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>delete_misses</td><td>' . number_format_i18n($memcachedinfo['delete_misses']) . '</td><td>' . __('Total number of times a DELETE command was unable to delete data', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>incr_hits</td><td>' . number_format_i18n($memcachedinfo['incr_hits']) . '</td><td>' . __('Total number of times a INCR command was able to increment a value', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>incr_misses</td><td>' . number_format_i18n($memcachedinfo['incr_misses']) . '</td><td>' . __('Total number of times a INCR command was unable to increment a value', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>decr_hits</td><td>' . number_format_i18n($memcachedinfo['decr_hits']) . '</td><td>' . __('Total number of times a DECR command was able to decrement a value', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>decr_misses</td><td>' . number_format_i18n($memcachedinfo['decr_misses']) . '</td><td>' . __('Total number of times a DECR command was unable to decrement a value', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>cas_hits</td><td>' . number_format_i18n($memcachedinfo['cas_hits']) . '</td><td>' . __('Total number of times a CAS command was able to compare and swap data', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>cas_misses</td><td>' . number_format_i18n($memcachedinfo['cas_misses']) . '</td><td>' . __('Total number of times a CAS command was unable to compare and swap data', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>cas_badval</td><td>' . number_format_i18n($memcachedinfo['cas_badval']) . '</td><td>' . __('N/A', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>bytes_read</td><td>' . format_filesize($memcachedinfo['bytes_read']) . '</td><td>' . __('Total number of bytes input into the server', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>bytes_written</td><td>' . format_filesize($memcachedinfo['bytes_written']) . '</td><td>' . __('Total number of bytes written by the server', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>evictions</td><td>' . number_format_i18n($memcachedinfo['evictions']) . '</td><td>' . __('Number of valid items removed from cache to free memory for new items', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '<tr class="" onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'\'"><td>reclaimed</td><td>' . number_format_i18n($memcachedinfo['reclaimed']) . '</td><td>' . __('Number of items reclaimed', 'wp-serverinfo') . '</td></tr>' . "\n"; echo '</tbody></table>' . "\n"; } } echo '</div>' . "\n"; }
/** * Get the statistics output from the current memcache pool. * * @return array The output from Memcache::getExtendedStats() using the * current configuration values. */ public function stats() { return $this->_memcache instanceof Memcached ? $this->_memcache->getStats() : $this->_memcache->getExtendedStats(); }