mirror of
https://github.com/symfony/symfony-docs.git
synced 2026-03-23 16:22:10 +01:00
Merge branch '6.4' into 7.3
* 6.4: Minor reword Add a note that checking for flash messages defeats HTTP cacheability
This commit is contained in:
12
session.rst
12
session.rst
@@ -265,6 +265,17 @@ It's common to use ``notice``, ``warning`` and ``error`` as the keys of the
|
||||
different types of flash messages, but you can use any key that fits your
|
||||
needs.
|
||||
|
||||
.. tip::
|
||||
|
||||
Accessing flash messages requires starting the session, which in turn
|
||||
causes Symfony to mark the response as ``private``. In general, because
|
||||
flash messages are meant to be displayed only once, pages that might show
|
||||
them cannot reasonably be cached by HTTP caches.
|
||||
|
||||
As an alternative, you can load flash messages asynchronously through
|
||||
another HTTP request (for example, using a `Twig Live Component`_), making
|
||||
the original page fully cacheable.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
@@ -1881,6 +1892,7 @@ the example below:
|
||||
can use the Symfony save handler without side effects and that the session
|
||||
has not been started before Symfony is initialized.
|
||||
|
||||
.. _`Twig Live Component`: https://symfony.com/bundles/ux-live-component/current/index.html
|
||||
.. _`phpredis extension`: https://github.com/phpredis/phpredis
|
||||
.. _`DoctrineMongoDBBundle configuration`: https://symfony.com/doc/master/bundles/DoctrineMongoDBBundle/config.html
|
||||
.. _`MongoDB shell`: https://docs.mongodb.com/manual/mongo/
|
||||
|
||||
Reference in New Issue
Block a user