@@ -301,9 +301,9 @@ The ``Cache-Control`` header is unique in that it contains not one, but various
301
301
pieces of information about the cacheability of a response. Each piece of
302
302
information is separated by a comma:
303
303
304
- Cache-Control: private, max-age=0, must-revalidate
304
+ Cache-Control: private, max-age=0, must-revalidate
305
305
306
- Cache-Control: max-age=3600, must-revalidate
306
+ Cache-Control: max-age=3600, must-revalidate
307
307
308
308
Symfony provides an abstraction around the ``Cache-Control `` header to make
309
309
its creation more manageable::
@@ -662,7 +662,7 @@ exposing a simple and efficient pattern::
662
662
// a database or a key-value store for instance)
663
663
$article = ...;
664
664
665
- // create a Response with a ETag and/or a Last-Modified header
665
+ // create a Response with an ETag and/or a Last-Modified header
666
666
$response = new Response();
667
667
$response->setETag($article->computeETag());
668
668
$response->setLastModified($article->getPublishedAt());
@@ -674,17 +674,17 @@ exposing a simple and efficient pattern::
674
674
if ($response->isNotModified($this->getRequest())) {
675
675
// return the 304 Response immediately
676
676
return $response;
677
- } else {
678
- // do more work here - like retrieving more data
679
- $comments = ...;
680
-
681
- // or render a template with the $response you've already started
682
- return $this->render(
683
- 'MyBundle:MyController:article.html.twig',
684
- array('article' => $article, 'comments' => $comments),
685
- $response
686
- );
687
677
}
678
+
679
+ // do more work here - like retrieving more data
680
+ $comments = ...;
681
+
682
+ // or render a template with the $response you've already started
683
+ return $this->render(
684
+ 'MyBundle:MyController:article.html.twig',
685
+ array('article' => $article, 'comments' => $comments),
686
+ $response
687
+ );
688
688
}
689
689
690
690
When the ``Response `` is not modified, the ``isNotModified() `` automatically sets
@@ -716,8 +716,6 @@ request's ``Accept-Encoding`` value. This is done by using the ``Vary`` response
716
716
header, which is a comma-separated list of different headers whose values
717
717
trigger a different representation of the requested resource:
718
718
719
- .. code-block :: text
720
-
721
719
Vary: Accept-Encoding, User-Agent
722
720
723
721
.. tip ::
@@ -951,8 +949,9 @@ component cache will only last for 60 seconds.
951
949
When using a controller reference, the ESI tag should reference the embedded
952
950
action as an accessible URL so the gateway cache can fetch it independently of
953
951
the rest of the page. Symfony2 takes care of generating a unique URL for any
954
- controller reference and it is able to route them properly thanks to a
955
- listener that must be enabled in your configuration:
952
+ controller reference and it is able to route them properly thanks to the
953
+ :class: `Symfony\\ Component\\ HttpKernel\\ EventListener\\ FragmentListener `
954
+ that must be enabled in your configuration:
956
955
957
956
.. configuration-block ::
958
957
@@ -1058,10 +1057,10 @@ Here is how you can configure the Symfony2 reverse proxy to support the
1058
1057
}
1059
1058
1060
1059
$response = new Response();
1061
- if (!$this->getStore()->purge($request->getUri())) {
1062
- $response->setStatusCode(404, 'Not purged');
1063
- } else {
1060
+ if ($this->getStore()->purge($request->getUri())) {
1064
1061
$response->setStatusCode(200, 'Purged');
1062
+ } else {
1063
+ $response->setStatusCode(404, 'Not purged');
1065
1064
}
1066
1065
1067
1066
return $response;
0 commit comments