@@ -401,8 +401,8 @@ header when none is set by the developer by following these rules:
401
401
402
402
.. _http-expiration-validation :
403
403
404
- HTTP Expiration and Validation
405
- ------------------------------
404
+ HTTP Expiration, Validation and Invalidation
405
+ --------------------------------------------
406
406
407
407
The HTTP specification defines two caching models:
408
408
@@ -419,7 +419,9 @@ The HTTP specification defines two caching models:
419
419
header) to check if the page has changed since being cached.
420
420
421
421
The goal of both models is to never generate the same response twice by relying
422
- on a cache to store and return "fresh" responses.
422
+ on a cache to store and return "fresh" responses. To achieve long caching times
423
+ but still provide updated content immediately, *cache invalidation * is
424
+ sometimes used.
10747
423
425
424
426
.. sidebar :: Reading the HTTP Specification
425
427
@@ -819,7 +821,7 @@ cache lifetimes, but to actively notify the gateway cache when content
819
821
changes. Reverse proxies usually provide a channel to receive such
820
822
notifications, typically through special HTTP requests.
821
823
822
- .. tip ::
824
+ .. warning ::
823
825
824
826
While cache invalidation is powerful, avoid it when possible. If you fail
825
827
to invalidate something, outdated caches will be served for a potentially
@@ -836,6 +838,13 @@ explicitly invalidating. For invalidation, your application needs to detect
836
838
when content changes and tell the cache to remove the URLs which contain
837
839
that data from its cache.
838
840
841
+ .. tip ::
842
+
843
+ If you want to use cache invalidation, have a look at the
844
+ `FOSHttpCacheBundle `_. This bundle provides services to help with various
845
+ cache invalidation concepts, and also documents the configuration for the
846
+ a couple of common caching proxies.
847
+
839
848
If one content corresponds to one URL, the ``PURGE `` model works well.
840
849
You send a request to the cache proxy with the HTTP method ``PURGE `` instead
841
850
of ``GET `` and make the cache proxy detect this and remove the data from the
@@ -894,10 +903,6 @@ different URLs. More flexible concepts exist for those cases:
894
903
* **Cache tagging ** lets you add a tag for each content used in a response
895
904
so that you can invalidate all URLs containing a certain content.
896
905
897
- If you need such features, you should use the `FOSHttpCacheBundle `_. This
898
- bundle documents the configuration for the caching proxy and provides
899
- services to send invalidation requests based on URLs and Symfony routes.
900
-
901
906
.. index ::
902
907
single: Cache; ESI
903
908
single: ESI
0 commit comments