public function CacheDataCollector::registerCacheHit in Devel 8
Same name and namespace in other branches
- 8.3 webprofiler/src/DataCollector/CacheDataCollector.php \Drupal\webprofiler\DataCollector\CacheDataCollector::registerCacheHit()
- 8.2 webprofiler/src/DataCollector/CacheDataCollector.php \Drupal\webprofiler\DataCollector\CacheDataCollector::registerCacheHit()
- 4.x webprofiler/src/DataCollector/CacheDataCollector.php \Drupal\webprofiler\DataCollector\CacheDataCollector::registerCacheHit()
Registers a cache get on a specific cache bin.
Parameters
$cache:
File
- webprofiler/
src/ DataCollector/ CacheDataCollector.php, line 41
Class
- CacheDataCollector
- Collects the used cache bins and cache CIDs.
Namespace
Drupal\webprofiler\DataCollectorCode
public function registerCacheHit($bin, $cache) {
$current = isset($this->data['cache'][$bin][$cache->cid]) ? $this->data['cache'][$bin][$cache->cid] : NULL;
if (!$current) {
$current = $cache;
$current->{CacheDataCollector::WEBPROFILER_CACHE_HIT} = 0;
$current->{CacheDataCollector::WEBPROFILER_CACHE_MISS} = 0;
$this->data['cache'][$bin][$cache->cid] = $current;
}
$current->{CacheDataCollector::WEBPROFILER_CACHE_HIT}++;
$this->data['total'][CacheDataCollector::WEBPROFILER_CACHE_HIT]++;
}