function parseMemcacheResults in Production check & Production monitor 7
Same name and namespace in other branches
- 6 includes/prod_check.memcache.inc \parseMemcacheResults()
1 call to parseMemcacheResults()
- sendMemcacheCommand in includes/
prod_check.memcache.inc
File
- includes/
prod_check.memcache.inc, line 102
Code
function parseMemcacheResults($str) {
$res = array();
$lines = explode("\r\n", $str);
$cnt = count($lines);
for ($i = 0; $i < $cnt; $i++) {
$line = $lines[$i];
$l = explode(' ', $line, 3);
if (count($l) == 3) {
$res[$l[0]][$l[1]] = $l[2];
if ($l[0] == 'VALUE') {
// next line is the value
$res[$l[0]][$l[1]] = array();
list($flag, $size) = explode(' ', $l[2]);
$res[$l[0]][$l[1]]['stat'] = array(
'flag' => $flag,
'size' => $size,
);
$res[$l[0]][$l[1]]['value'] = $lines[++$i];
}
}
elseif ($line == 'DELETED' || $line == 'NOT_FOUND' || $line == 'OK') {
return $line;
}
}
return $res;
}