/** * {@inheritdoc} */ public function flush() { if (!$this->proxyClient instanceof PurgeInterface) { return false; } if (!$this->pathsToInvalidate) { return true; } foreach ($this->pathsToInvalidate as $entry) { $this->proxyClient->purge($entry['path'], $entry['headers']); } $this->proxyClient->flush(); return true; }
/** * {@inheritDoc} */ public function flush() { if (!$this->structuresToInvalidate) { return; } foreach ($this->structuresToInvalidate as $structure) { if (false === $structure->hasTag('sulu.rlp') || null === ($rlp = $structure->getPropertyValueByTagName('sulu.rlp'))) { return; } $urls = $this->webspaceManager->findUrlsByResourceLocator($rlp, $this->environment, $structure->getLanguageCode(), $structure->getWebspaceKey()); foreach ($urls as $url) { $this->proxyClient->purge($url); } } $this->proxyClient->flush(); }
/** * Invalidate a path or URL * * @param string $path Path or URL * @param array $headers HTTP headers (optional) * * @throws UnsupportedProxyOperationException * * @return $this */ public function invalidatePath($path, array $headers = []) { if (!$this->cache instanceof PurgeInterface) { throw UnsupportedProxyOperationException::cacheDoesNotImplement('PURGE'); } $this->cache->purge($path, $headers); return $this; }