/** * Store cache set information * * @param $event */ public function onCacheSet(CacheEvent $event) { $key = $event->getCacheabledata()->getHashKey(); if (isset(self::$collectedData[$key]['set'])) { self::$collectedData[$key]['set']++; } else { self::$collectedData[$key]['set'] = 1; } self::$collectedData[$key]['size'] = strlen($event->getCacheabledata()->getDataForCache()); }
/** * Store cache remove information * * @param $event */ public function onCacheRemove(CacheEvent $event) { $key = $event->getCacheabledata()->getHashKey(); if (isset(self::$data[$key]['remove'])) { self::$data[$key]['remove']++; } else { self::$data[$key]['remove'] = 1; } self::$removeCount++; }
/** * Remove entity cache * * @param CacheEvent $event * * @return void */ public function removeEntityCache(CacheEvent $event) { $this->cache->remove($event->getCacheableData()); }