public function MemcacheStatsObject::getGets in Memcache API and Integration 8.2
Statistics report: calculate # of get cmds, broken down by hits and misses.
Overrides MemcacheStatsInterface::getGets
1 method overrides MemcacheStatsObject::getGets()
- McrouterStatsObject::getGets in memcache_admin/
src/ Stats/ McrouterStatsObject.php - Statistics report: calculate # of get cmds, broken down by hits and misses.
File
- memcache_admin/
src/ Stats/ MemcacheStatsObject.php, line 118
Class
- MemcacheStatsObject
- Class MemcacheStats.
Namespace
Drupal\memcache_admin\StatsCode
public function getGets() : string {
if (!isset($this->stats['cmd_set']) || !isset($this->stats['cmd_get'])) {
return self::NA;
}
else {
$get = $this->stats['cmd_get'];
$set = $this->stats['cmd_set'];
$hits = isset($this->stats['get_hits']) ?? 0;
$misses = isset($this->stats['get_misses']) ?? 0;
}
if ($set + $get == 0) {
$gets = 0;
}
else {
$gets = $get / ($set + $get) * 100;
}
if (empty($stats['uptime'])) {
$average = 0;
}
else {
$average = $get / $stats['uptime'];
}
return $this
->t('@average/s; @total gets (@gets%); @hit hits (@percent_hit%) @miss misses (@percent_miss%)', [
'@average' => number_format($average, 2),
'@gets' => number_format($gets, 2),
'@hit' => number_format($hits),
'@percent_hit' => $get > 0 ? number_format($hits / $get * 100, 2) : '0.00',
'@miss' => number_format($misses),
'@percent_miss' => $get > 0 ? number_format($misses / $get * 100, 2) : '0.00',
'@total' => number_format($get),
]);
}