You are here

function getCacheItems in Production check & Production monitor 6

Same name and namespace in other branches
  1. 7 includes/prod_check.memcache.inc \getCacheItems()
1 call to getCacheItems()
prod_check.memcache.inc in includes/prod_check.memcache.inc

File

includes/prod_check.memcache.inc, line 139

Code

function getCacheItems() {
  $items = sendMemcacheCommands('stats items');
  $serverItems = array();
  $totalItems = array();
  foreach ($items as $server => $itemlist) {
    $serverItems[$server] = array();
    $totalItems[$server] = 0;
    if (!isset($itemlist['STAT'])) {
      continue;
    }
    $iteminfo = $itemlist['STAT'];
    foreach ($iteminfo as $keyinfo => $value) {
      if (preg_match('/items\\:(\\d+?)\\:(.+?)$/', $keyinfo, $matches)) {
        $serverItems[$server][$matches[1]][$matches[2]] = $value;
        if ($matches[2] == 'number') {
          $totalItems[$server] += $value;
        }
      }
    }
  }
  return array(
    'items' => $serverItems,
    'counts' => $totalItems,
  );
}