6
6
use FOS \HttpCache \Exception \InvalidArgumentException ;
7
7
use FOS \HttpCache \Exception \ProxyResponseException ;
8
8
use FOS \HttpCache \Exception \ProxyUnreachableException ;
9
- use FOS \HttpCache \Exception \UnsupportedInvalidationMethodException ;
10
- use FOS \HttpCache \Invalidation \ CacheProxyInterface ;
11
- use FOS \HttpCache \Invalidation \ Method \BanInterface ;
12
- use FOS \HttpCache \Invalidation \ Method \PurgeInterface ;
13
- use FOS \HttpCache \Invalidation \ Method \RefreshInterface ;
9
+ use FOS \HttpCache \Exception \UnsupportedProxyOperationException ;
10
+ use FOS \HttpCache \ProxyClient \ ProxyClientInterface ;
11
+ use FOS \HttpCache \ProxyClient \ Invalidation \BanInterface ;
12
+ use FOS \HttpCache \ProxyClient \ Invalidation \PurgeInterface ;
13
+ use FOS \HttpCache \ProxyClient \ Invalidation \RefreshInterface ;
14
14
use Symfony \Component \EventDispatcher \EventDispatcher ;
15
15
use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
16
16
use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
@@ -38,7 +38,7 @@ class CacheInvalidator
38
38
const INVALIDATE = 'invalidate ' ;
39
39
40
40
/**
41
- * @var CacheProxyInterface
41
+ * @var ProxyClientInterface
42
42
*/
43
43
protected $ cache ;
44
44
@@ -55,9 +55,9 @@ class CacheInvalidator
55
55
/**
56
56
* Constructor
57
57
*
58
- * @param CacheProxyInterface $cache HTTP cache
58
+ * @param ProxyClientInterface $cache HTTP cache
59
59
*/
60
- public function __construct (CacheProxyInterface $ cache )
60
+ public function __construct (ProxyClientInterface $ cache )
61
61
{
62
62
$ this ->cache = $ cache ;
63
63
}
@@ -159,14 +159,14 @@ public function getTagsHeader()
159
159
*
160
160
* @param string $path Path or URL
161
161
*
162
- * @throws UnsupportedInvalidationMethodException
162
+ * @throws UnsupportedProxyOperationException
163
163
*
164
164
* @return $this
165
165
*/
166
166
public function invalidatePath ($ path )
167
167
{
168
168
if (!$ this ->cache instanceof PurgeInterface) {
169
- throw UnsupportedInvalidationMethodException ::cacheDoesNotImplement ('PURGE ' );
169
+ throw UnsupportedProxyOperationException ::cacheDoesNotImplement ('PURGE ' );
170
170
}
171
171
172
172
$ this ->cache ->purge ($ path );
@@ -182,14 +182,14 @@ public function invalidatePath($path)
182
182
*
183
183
* @see RefreshInterface::refresh()
184
184
*
185
- * @throws UnsupportedInvalidationMethodException
185
+ * @throws UnsupportedProxyOperationException
186
186
*
187
187
* @return $this
188
188
*/
189
189
public function refreshPath ($ path , array $ headers = array ())
190
190
{
191
191
if (!$ this ->cache instanceof RefreshInterface) {
192
- throw UnsupportedInvalidationMethodException ::cacheDoesNotImplement ('REFRESH ' );
192
+ throw UnsupportedProxyOperationException ::cacheDoesNotImplement ('REFRESH ' );
193
193
}
194
194
195
195
$ this ->cache ->refresh ($ path , $ headers );
@@ -207,14 +207,14 @@ public function refreshPath($path, array $headers = array())
207
207
*
208
208
* @param array $headers HTTP headers that path must match to be banned.
209
209
*
210
- * @throws UnsupportedInvalidationMethodException If HTTP cache does not support BAN requests
210
+ * @throws UnsupportedProxyOperationException If HTTP cache does not support BAN requests
211
211
*
212
212
* @return $this
213
213
*/
214
214
public function invalidate (array $ headers )
215
215
{
216
216
if (!$ this ->cache instanceof BanInterface) {
217
- throw UnsupportedInvalidationMethodException ::cacheDoesNotImplement ('BAN ' );
217
+ throw UnsupportedProxyOperationException ::cacheDoesNotImplement ('BAN ' );
218
218
}
219
219
220
220
$ this ->cache ->ban ($ headers );
@@ -240,14 +240,14 @@ public function invalidate(array $headers)
240
240
* @param array|string $hosts Regular expression of a host name or list of
241
241
* exact host names to limit banning.
242
242
*
243
- * @throws UnsupportedInvalidationMethodException If HTTP cache does not support BAN requests
243
+ * @throws UnsupportedProxyOperationException If HTTP cache does not support BAN requests
244
244
*
245
245
* @return $this
246
246
*/
247
247
public function invalidateRegex ($ path , $ contentType = null , $ hosts = null )
248
248
{
249
249
if (!$ this ->cache instanceof BanInterface) {
250
- throw UnsupportedInvalidationMethodException ::cacheDoesNotImplement ('BAN ' );
250
+ throw UnsupportedProxyOperationException ::cacheDoesNotImplement ('BAN ' );
251
251
}
252
252
253
253
$ this ->cache ->banPath ($ path , $ contentType , $ hosts );
@@ -263,14 +263,14 @@ public function invalidateRegex($path, $contentType = null, $hosts = null)
263
263
*
264
264
* @param array $tags Cache tags
265
265
*
266
- * @throws UnsupportedInvalidationMethodException If HTTP cache does not support BAN requests
266
+ * @throws UnsupportedProxyOperationException If HTTP cache does not support BAN requests
267
267
*
268
268
* @return $this
269
269
*/
270
270
public function invalidateTags (array $ tags )
271
271
{
272
272
if (!$ this ->cache instanceof BanInterface) {
273
- throw UnsupportedInvalidationMethodException ::cacheDoesNotImplement ('BAN ' );
273
+ throw UnsupportedProxyOperationException ::cacheDoesNotImplement ('BAN ' );
274
274
}
275
275
276
276
$ headers = array ($ this ->getTagsHeader () => '( ' .implode ('| ' , $ tags ).')(,.+)?$ ' );
0 commit comments