function 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]++;
}