You are here

function _memcache_admin_stats_sets in Memcache API and Integration 7

Same name and namespace in other branches
  1. 6 memcache_admin/memcache_admin.module \_memcache_admin_stats_sets()

Statistics report: calculate # of set cmds and total cmds.

1 call to _memcache_admin_stats_sets()
memcache_admin_stats in memcache_admin/memcache_admin.module
Callback for the Memcache Stats page.

File

memcache_admin/memcache_admin.module, line 145
For the collection and display of memcache stats.

Code

function _memcache_admin_stats_sets($stats) {
  if ($stats['cmd_set'] + $stats['cmd_get'] == 0) {
    $sets = 0;
  }
  else {
    $sets = $stats['cmd_set'] / ($stats['cmd_set'] + $stats['cmd_get']) * 100;
  }
  if (empty($stats['uptime'])) {
    $average = 0;
  }
  else {
    $average = $sets / $stats['uptime'];
  }
  return t('!average/s; !set sets (!sets%) of !total commands', array(
    '!average' => number_format($average, 2),
    '!sets' => number_format($sets, 2),
    '!set' => number_format($stats['cmd_set']),
    '!total' => number_format($stats['cmd_set'] + $stats['cmd_get']),
  ));
}