File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,9 @@ api_platform:
253
253
# To pass options to the client charged with the request.
254
254
request_options : []
255
255
256
+ # Use another service as the purger for example "api_platform.http_cache.purger.varnish.xkey"
257
+ purger : ' api_platform.http_cache.purger.varnish.ban'
258
+
256
259
# Automatically generate etags for API responses.
257
260
# Deprecated since 2.6 and will be removed in 3.0, use defaults.cache_headers.etag instead.
258
261
etag : true
@@ -372,6 +375,10 @@ api_platform:
372
375
# Default values of the "Vary" HTTP header.
373
376
vary : ['Accept']
374
377
378
+ invalidation :
379
+ xkey :
380
+ glue : ' '
381
+
375
382
normalization_context : ~
376
383
denormalization_context : ~
377
384
swagger_context : ~
Original file line number Diff line number Diff line change @@ -41,6 +41,27 @@ api_platform:
41
41
` ` `
42
42
43
43
Support for reverse proxies other than Varnish can easily be added by implementing the ` ApiPlatform\HttpCache\PurgerInterface`.
44
+ Two purgers are available, the http tags (`api_platform.http_cache.purger.varnish.ban`) or the surrogate key implementation
45
+ (`api_platform.http_cache.purger.varnish.xkey`). You can specify the implementation using the `purger` configuration node,
46
+ for example to use the xkey implementation :
47
+
48
+ ` ` ` yaml
49
+ api_platform:
50
+ http_cache:
51
+ invalidation:
52
+ enabled: true
53
+ varnish_urls: ['%env(VARNISH_URL)%']
54
+ purger: 'api_platform.http_cache.purger.varnish.xkey'
55
+ public: true
56
+ defaults:
57
+ cache_headers:
58
+ max_age: 0
59
+ shared_max_age: 3600
60
+ vary: ['Content-Type', 'Authorization', 'Origin']
61
+ invalidation:
62
+ xkey:
63
+ glue: ', '
64
+ ` ` `
44
65
45
66
In addition to the cache invalidation mechanism, you may want to [use HTTP/2 Server Push to pre-emptively send relations
46
67
to the client](push-relations.md).
You can’t perform that action at this time.
0 commit comments