You are here

public function CacheDataCollector::cacheCids in Devel 4.x

Same name and namespace in other branches
  1. 8.3 webprofiler/src/DataCollector/CacheDataCollector.php \Drupal\webprofiler\DataCollector\CacheDataCollector::cacheCids()
  2. 8 webprofiler/src/DataCollector/CacheDataCollector.php \Drupal\webprofiler\DataCollector\CacheDataCollector::cacheCids()
  3. 8.2 webprofiler/src/DataCollector/CacheDataCollector.php \Drupal\webprofiler\DataCollector\CacheDataCollector::cacheCids()

Callback to return the total amount of hit cache CIDs keyed by bin.

Parameters

$type:

Return value

array

2 calls to CacheDataCollector::cacheCids()
CacheDataCollector::getCacheHits in webprofiler/src/DataCollector/CacheDataCollector.php
Callback to return hit cache CIDs keyed by bin.
CacheDataCollector::getCacheMisses in webprofiler/src/DataCollector/CacheDataCollector.php
Callback to return miss cache CIDs keyed by bin.

File

webprofiler/src/DataCollector/CacheDataCollector.php, line 112

Class

CacheDataCollector
Collects the used cache bins and cache CIDs.

Namespace

Drupal\webprofiler\DataCollector

Code

public function cacheCids($type) {
  $hits = [];
  foreach ($this->data['cache'] as $bin => $caches) {
    $hits[$bin] = 0;
    foreach ($caches as $cache) {
      $hits[$bin] += $cache->{$type};
    }
  }
  return $hits;
}