diff --git a/http_cache.rst b/http_cache.rst index fab88f07f92..fd49fe7613e 100644 --- a/http_cache.rst +++ b/http_cache.rst @@ -125,6 +125,8 @@ finely tuned via a set of options you can set by overriding the method:: // src/CacheKernel.php + namespace App; + use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache; class CacheKernel extends HttpCache @@ -141,10 +143,9 @@ method:: For a full list of the options and their meaning, see the :method:`HttpCache::__construct() documentation `. -When you're in debug mode (either because your booting a ``debug`` kernel, like -in ``index.php`` *or* you manually set the ``debug`` option to true), Symfony -automatically adds an ``X-Symfony-Cache`` header to the response. Use this to get -information about cache hits and misses. +When you're in debug mode (the second argument of ``Kernel`` constructor in the +front controller is ``true``), Symfony automatically adds an ``X-Symfony-Cache`` +header to the response. Use this to get information about cache hits and misses. .. _http-cache-symfony-versus-varnish: @@ -218,7 +219,7 @@ The *easiest* way to cache a response is by caching it for a specific amount of use Symfony\Component\HttpFoundation\Response; // ... - public function indexAction() + public function index() { // somehow create a Response object, like by rendering a template $response = $this->render('blog/index.html.twig', []); diff --git a/http_cache/esi.rst b/http_cache/esi.rst index 6276bf5110e..e5a7d46eac9 100644 --- a/http_cache/esi.rst +++ b/http_cache/esi.rst @@ -62,14 +62,14 @@ First, to use ESI, be sure to enable it in your application configuration: .. code-block:: yaml - # app/config/config.yml + # config/packages/framework.yaml framework: # ... esi: { enabled: true } .. code-block:: xml - + loadFromExtension('framework', array( // ... 'esi' => array('enabled' => true), @@ -104,7 +104,7 @@ independent of the rest of the page. // ... class DefaultController extends Controller { - public function aboutAction() + public function about() { $response = $this->render('static/about.html.twig'); // set the shared max age - which also marks the response as public @@ -195,7 +195,7 @@ of the master page. // ... class NewsController extends Controller { - public function latestAction($maxPerPage) + public function latest($maxPerPage) { // ... $response->setSharedMaxAge(60); @@ -220,14 +220,14 @@ that must be enabled in your configuration: .. code-block:: yaml - # app/config/config.yml + # config/packages/framework.yaml framework: # ... fragments: { path: /_fragment } .. code-block:: xml - + loadFromExtension('framework', array( // ... 'fragments' => array('path' => '/_fragment'), diff --git a/http_cache/validation.rst b/http_cache/validation.rst index 97dff6f41a0..260c7667eb5 100644 --- a/http_cache/validation.rst +++ b/http_cache/validation.rst @@ -66,7 +66,7 @@ To see a simple implementation, generate the ETag as the md5 of the content:: class DefaultController extends Controller { - public function homepageAction(Request $request) + public function homepage(Request $request) { $response = $this->render('static/homepage.html.twig'); $response->setEtag(md5($response->getContent())); @@ -131,7 +131,7 @@ header value:: class ArticleController extends Controller { - public function showAction(Article $article, Request $request) + public function show(Article $article, Request $request) { $author = $article->getAuthor(); @@ -190,7 +190,7 @@ exposing a simple and efficient pattern:: class ArticleController extends Controller { - public function showAction($articleSlug, Request $request) + public function show($articleSlug, Request $request) { // Get the minimum information to compute // the ETag or the Last-Modified value