You are here

public function CacheDataCollector::cacheCids in Devel 8

Same name and namespace in other branches
  1. 8.3 webprofiler/src/DataCollector/CacheDataCollector.php \Drupal\webprofiler\DataCollector\CacheDataCollector::cacheCids()
  2. 8.2 webprofiler/src/DataCollector/CacheDataCollector.php \Drupal\webprofiler\DataCollector\CacheDataCollector::cacheCids()
  3. 4.x 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 $cid => $cache) {
      $hits[$bin] += $cache->{$type};
    }
  }
  return $hits;
}