/** * Clear all cache in Varnish for a optionally given domain & content type * * @param string $domain The domain to flush, e.g. "example.com" * @param string $contentType The mime type to flush, e.g. "image/png" * @return void */ public function banAll($domain = NULL, $contentType = NULL) { $this->cacheInvalidator->invalidateRegex('.*', $contentType, $domain); $this->systemLogger->log(sprintf('Cleared all cache%s%s', $domain ? ' for domain "' . $domain . '"' : '', $contentType ? ' with content type "' . $contentType . '"' : '')); $this->execute(); }
public function testMethodException() { $proxyClient = \Mockery::mock('\FOS\HttpCache\ProxyClient\ProxyClientInterface'); $cacheInvalidator = new CacheInvalidator($proxyClient); try { $cacheInvalidator->invalidatePath('/'); $this->fail('Expected exception'); } catch (UnsupportedProxyOperationException $e) { // success } try { $cacheInvalidator->refreshPath('/'); $this->fail('Expected exception'); } catch (UnsupportedProxyOperationException $e) { // success } try { $cacheInvalidator->invalidate(array()); $this->fail('Expected exception'); } catch (UnsupportedProxyOperationException $e) { // success } try { $cacheInvalidator->invalidateRegex('/'); $this->fail('Expected exception'); } catch (UnsupportedProxyOperationException $e) { // success } try { $cacheInvalidator->invalidateTags(array()); $this->fail('Expected exception'); } catch (UnsupportedProxyOperationException $e) { // success } }