You are here

protected function MemcacheStatisticsController::getBinMapping in Memcache API and Integration 8.2

Helper function, reverse map the memcache_bins variable.

1 call to MemcacheStatisticsController::getBinMapping()
MemcacheStatisticsController::statsTable in memcache_admin/src/Controller/MemcacheStatisticsController.php
Callback for the Memcache Stats page.

File

memcache_admin/src/Controller/MemcacheStatisticsController.php, line 318

Class

MemcacheStatisticsController
Memcache Statistics.

Namespace

Drupal\memcache_admin\Controller

Code

protected function getBinMapping($bin = 'cache') {
  $memcache = \Drupal::service('memcache.factory')
    ->get(NULL, TRUE);
  $memcache_bins = $memcache
    ->getBins();
  $bins = array_flip($memcache_bins);
  if (isset($bins[$bin])) {
    return $bins[$bin];
  }
  else {
    return $this
      ->defaultBin($bin);
  }
}