You are here

function memcache_admin_stats in Memcache API and Integration 5.2

Same name and namespace in other branches
  1. 5 memcache_admin/memcache_admin.module \memcache_admin_stats()
  2. 6 memcache_admin/memcache_admin.module \memcache_admin_stats()
  3. 7 memcache_admin/memcache_admin.module \memcache_admin_stats()
1 string reference to 'memcache_admin_stats'
memcache_admin_menu in memcache_admin/memcache_admin.module

File

memcache_admin/memcache_admin.module, line 65

Code

function memcache_admin_stats($cluster = NULL, $type = 'default') {
  $bin = _memcache_admin_get_bin_for_cluster($cluster);
  $output = t('Please select a cluster');
  if ($bin) {
    if ($type == 'default') {
      $type = '';
    }
    $stats = dmemcache_stats($bin, $type);
    if (is_array($stats) && count($stats)) {
      $output = "";
      foreach ($stats as $server => $values) {
        if (is_array($values)) {
          $output .= theme('memcache_admin_stats_table', $server, $values);
        }
        else {
          drupal_set_message(t('Unable to connect to server: %server', array(
            '%server' => $server,
          )));
        }
      }
    }
    else {
      $output = '';
      drupal_set_message(t('There seem to be no stats for this bin...'));
    }
  }
  return $output;
}