/** * @param ServiceEvent $event */ public function onCacheLoaded(ServiceEvent $event) { $service = $event->getService(); if (!$this->isEligibile($service)) { return; } $serviceHashKey = $service->getHashKey(); $this->queueWriter->addItem($serviceHashKey, $serviceHashKey); }
/** * @param callable $logCallback */ public function processAll(\Closure $logCallback = null) { while (null !== ($key = $this->reader->getFirstItem())) { try { $cachedService = $this->cacheAdapter->get($this->createCacheItem($key)); $this->writer->removeItem($key); if ($cachedService instanceof AbstractService) { $service = $this->services->getServiceByIdentifier($cachedService->getIdentifier()); $this->cacheWarmer->warm($service, $cachedService); $this->log($logCallback, sprintf('SUCCESS ON REFRESH KEY %s', $key)); } } catch (\Exception $e) { $this->log($logCallback, sprintf('ERROR ON REFRESH KEY %s : %s', $key, $e->getMessage())); } } }