/** * * @param ViewModel $viewModel */ private function extractCacheTags(ViewModel $viewModel) { if ($viewModel->getOption('esi') && !$viewModel->terminate()) { return; } $tags = (array) $viewModel->getOption(self::OPTION_CACHE_TAGS, []); $this->cacheTags = ArrayUtils::merge($this->cacheTags, $tags); if ($viewModel->hasChildren()) { foreach ($viewModel->getChildren() as $childViewModel) { $this->extractCacheTags($childViewModel); } } }
/** * * @param ViewModel $block * @return array */ private function getHandles(ViewModel $block) { $options = $block->getOption('esi'); $optionHandles = isset($options['handles']) ? (array) $options['handles'] : []; $currentHandles = $this->layoutUpdater->getHandles(true); $handlesIndex = []; foreach ($currentHandles as $currentHandle) { $handlesIndex[$currentHandle->getName()] = $currentHandle->getPriority(); } $handles = []; foreach ($optionHandles as $optionHandle) { $priority = isset($handlesIndex[$optionHandle]) ? $handlesIndex[$optionHandle] : 1; $handles[$optionHandle] = $priority; } return $handles; }