You are here

public function MemcacheStatsObject::getTransferred in Memcache API and Integration 8.2

@inheritDoc

Overrides MemcacheStatsInterface::getTransferred

1 method overrides MemcacheStatsObject::getTransferred()
McrouterStatsObject::getTransferred in memcache_admin/src/Stats/McrouterStatsObject.php
@inheritDoc

File

memcache_admin/src/Stats/MemcacheStatsObject.php, line 176

Class

MemcacheStatsObject
Class MemcacheStats.

Namespace

Drupal\memcache_admin\Stats

Code

public function getTransferred() : string {
  $read = isset($this->stats['bytes_read']) ?? 0;
  $write = isset($this->stats['bytes_written']) ?? 0;
  if ($write == 0) {
    $written = 0;
  }
  else {
    $written = $read / $write * 100;
  }
  return $this
    ->t('@to:@from (@written% to cache)', [
    '@to' => format_size((int) $read),
    '@from' => format_size((int) $write),
    '@written' => number_format($written, 2),
  ]);
}