Skip to content

Commit ecf6976

Browse files
committed
Document the terminate_on_cache_hit option
1 parent 5970069 commit ecf6976

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

components/http_foundation.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,13 +517,18 @@ call::
517517
'immutable' => true,
518518
'last_modified' => new \DateTime(),
519519
'etag' => 'abcdef',
520+
'terminate_on_cache_hit' => false,
520521
]);
521522

522523
.. versionadded:: 6.1
523524

524525
The ``stale_if_error`` and ``stale_while_revalidate`` options were
525526
introduced in Symfony 6.1.
526527

528+
.. versionadded:: 6.2
529+
530+
The ``terminate_on_cache_hit`` option was introduced in Symfony 6.2.
531+
527532
To check if the Response validators (``ETag``, ``Last-Modified``) match a
528533
conditional value specified in the client Request, use the
529534
:method:`Symfony\\Component\\HttpFoundation\\Response::isNotModified`

reference/configuration/framework.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,22 @@ which the cache can serve a stale response when an error is encountered
144144
(default: 60). This setting is overridden by the stale-if-error HTTP
145145
Cache-Control extension (see RFC 5861).
146146

147+
terminate_on_cache_hit
148+
......................
149+
150+
**type**: ``boolean`` **default**: ``true``
151+
152+
If ``true``, the :ref:`kernel.terminate <component-http-kernel-kernel-terminate>`
153+
event is dispatched even when the cache is hit.
154+
155+
Unless your application needs to process events on cache hits, it's recommended
156+
to set this to ``false`` to improve performance, because it avoids having to
157+
bootstrap the Symfony framework on a cache hit.
158+
159+
.. versionadded:: 6.2
160+
161+
The ``terminate_on_cache_hit`` option was introduced in Symfony 6.2.
162+
147163
.. _configuration-framework-http_method_override:
148164

149165
http_method_override

0 commit comments

Comments
 (0)