Skip to content

Commit 5a94963

Browse files
committed
feat(http_cache): document xkey purger
1 parent 8192b40 commit 5a94963

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

core/configuration.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ api_platform:
253253
# To pass options to the client charged with the request.
254254
request_options: []
255255

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+
256259
# Automatically generate etags for API responses.
257260
# Deprecated since 2.6 and will be removed in 3.0, use defaults.cache_headers.etag instead.
258261
etag: true
@@ -372,6 +375,10 @@ api_platform:
372375
# Default values of the "Vary" HTTP header.
373376
vary: ['Accept']
374377

378+
invalidation:
379+
xkey:
380+
glue: ' '
381+
375382
normalization_context: ~
376383
denormalization_context: ~
377384
swagger_context: ~

core/performance.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,27 @@ api_platform:
4141
```
4242
4343
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+
```
4465

4566
In addition to the cache invalidation mechanism, you may want to [use HTTP/2 Server Push to pre-emptively send relations
4667
to the client](push-relations.md).

0 commit comments

Comments
 (0)