8000 move fos httpcache bundle tip up to beginning of invalidation section · symfony/symfony-docs@979034a · GitHub
[go: up one dir, main page]

Skip to content

Commit 979034a

Browse files
committed
move fos httpcache bundle tip up to beginning of invalidation section
1 parent 2bddbb1 commit 979034a

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

book/http_cache.rst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ header when none is set by the developer by following these rules:
401401

402402
.. _http-expiration-validation:
403403

404-
HTTP Expiration and Validation
405-
------------------------------
404+
HTTP Expiration, Validation and Invalidation
405+
--------------------------------------------
406406

407407
The HTTP specification defines two caching models:
408408

@@ -419,7 +419,9 @@ The HTTP specification defines two caching models:
419419
header) to check if the page has changed since being cached.
420420

421421
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.
423425

424426
.. sidebar:: Reading the HTTP Specification
425427

@@ -819,7 +821,7 @@ cache lifetimes, but to actively notify the gateway cache when content
819821
changes. Reverse proxies usually provide a channel to receive such
820822
notifications, typically through special HTTP requests.
821823

822-
.. tip::
824+
.. warning::
823825

824826
While cache invalidation is powerful, avoid it when possible. If you fail
825827
to invalidate something, outdated caches will be served for a potentially
@@ -836,6 +838,13 @@ explicitly invalidating. For invalidation, your application needs to detect
836838
when content changes and tell the cache to remove the URLs which contain
837839
that data from its cache.
838840

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+
839848
If one content corresponds to one URL, the ``PURGE`` model works well.
840849
You send a request to the cache proxy with the HTTP method ``PURGE`` instead
841850
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:
894903
* **Cache tagging** lets you add a tag for each content used in a response
895904
so that you can invalidate all URLs containing a certain content.
896905

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-
901906
.. index::
902907
single: Cache; ESI
903908
single: ESI

0 commit comments

Comments
 (0)
0