@@ -301,9 +301,11 @@ The ``Cache-Control`` header is unique in that it contains not one, but various
301301pieces of information about the cacheability of a response. Each piece of
302302information is separated by a comma:
303303
304- Cache-Control: private, max-age=0, must-revalidate
304+ .. code-block :: text
305+
306+ Cache-Control: private, max-age=0, must-revalidate
305307
306- Cache-Control: max-age=3600, must-revalidate
308+ Cache-Control: max-age=3600, must-revalidate
307309
308310 Symfony provides an abstraction around the ``Cache-Control `` header to make
309311its creation more manageable::
@@ -385,7 +387,7 @@ header when none is set by the developer by following these rules:
385387* If ``Cache-Control `` is empty (but one of the other cache headers is present),
386388 its value is set to ``private, must-revalidate ``;
387389
388- * But if at least one ``Cache-Control `` directive is set, and no ' public' or
390+ * But if at least one ``Cache-Control `` directive is set, and no `` public `` or
389391 ``private `` directives have been explicitly added, Symfony2 adds the
390392 ``private `` directive automatically (except when ``s-maxage `` is set).
391393
@@ -667,7 +669,7 @@ exposing a simple and efficient pattern::
667669 // a database or a key-value store for instance)
668670 $article = ...;
669671
670- // create a Response with a ETag and/or a Last-Modified header
672+ // create a Response with an ETag and/or a Last-Modified header
671673 $response = new Response();
672674 $response->setETag($article->computeETag());
673675 $response->setLastModified($article->getPublishedAt());
@@ -679,17 +681,17 @@ exposing a simple and efficient pattern::
679681 if ($response->isNotModified($request)) {
680682 // return the 304 Response immediately
681683 return $response;
682- } else {
683- // do more work here - like retrieving more data
684- $comments = ...;
685-
686- // or render a template with the $response you've already started
687- return $this->render(
688- 'MyBundle:MyController:article.html.twig',
689- array('article' => $article, 'comments' => $comments),
690- $response
691- );
692684 }
685+
686+ // do more work here - like retrieving more data
687+ $comments = ...;
688+
689+ // or render a template with the $response you've already started
690+ return $this->render(
691+ 'MyBundle:MyController:article.html.twig',
692+ array('article' => $article, 'comments' => $comments),
693+ $response
694+ );
693695 }
694696
695697When the ``Response `` is not modified, the ``isNotModified() `` automatically sets
@@ -956,8 +958,9 @@ component cache will only last for 60 seconds.
956958When using a controller reference, the ESI tag should reference the embedded
957959action as an accessible URL so the gateway cache can fetch it independently of
958960the rest of the page. Symfony2 takes care of generating a unique URL for any
959- controller reference and it is able to route them properly thanks to a
960- listener that must be enabled in your configuration:
961+ controller reference and it is able to route them properly thanks to the
962+ :class: `Symfony\\ Component\\ HttpKernel\\ EventListener\\ FragmentListener `
963+ that must be enabled in your configuration:
961964
962965.. configuration-block ::
963966
@@ -1063,10 +1066,10 @@ Here is how you can configure the Symfony2 reverse proxy to support the
10631066 }
10641067
10651068 $response = new Response();
1066- if (!$this->getStore()->purge($request->getUri())) {
1067- $response->setStatusCode(Response::HTTP_NOT_FOUND, 'Not purged');
1068- } else {
1069+ if ($this->getStore()->purge($request->getUri())) {
10691070 $response->setStatusCode(Response::HTTP_OK, 'Purged');
1071+ } else {
1072+ $response->setStatusCode(Response::HTTP_NOT_FOUND, 'Not purged');
10701073 }
10711074
10721075 return $response;
@@ -1104,6 +1107,6 @@ Learn more from the Cookbook
11041107.. _`validation model` : http://tools.ietf.org/html/rfc2616#section-13.3
11051108.. _`RFC 2616` : http://tools.ietf.org/html/rfc2616
11061109.. _`HTTP Bis` : http://tools.ietf.org/wg/httpbis/
1107- .. _`P4 - Conditional Requests` : http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-12
1108- .. _`P6 - Caching: Browser and intermediary caches` : http://tools.ietf.org/html/draft-ietf-httpbis-p6-cache-12
1110+ .. _`P4 - Conditional Requests` : http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional
1111+ .. _`P6 - Caching: Browser and intermediary caches` : http://tools.ietf.org/html/draft-ietf-httpbis-p6-cache
11091112.. _`ESI` : http://www.w3.org/TR/esi-lang
0 commit comments