Skip to content

Commit 9c537a7

Browse files
committed
minor symfony#11055 Document the kernel.reset tag (javiereguiluz)
This PR was merged into the 3.4 branch. Discussion ---------- Document the kernel.reset tag Fixes symfony#11035. Commits ------- 822a16c Document the kernel.reset tag
2 parents b5f1ca0 + 822a16c commit 9c537a7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

reference/dic_tags.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Tag Name Usage
3232
`kernel.event_listener`_ Listen to different events/hooks in Symfony
3333
`kernel.event_subscriber`_ To subscribe to a set of different events/hooks in Symfony
3434
`kernel.fragment_renderer`_ Add new HTTP content rendering strategies
35+
`kernel.reset`_ Allows to clean up services between requests
3536
`monolog.logger`_ Logging with a custom logging channel
3637
`monolog.processor`_ Add a custom processor for logging
3738
`routing.loader`_ Register a custom service that loads routes
@@ -632,6 +633,21 @@ To add a new rendering strategy - in addition to the core strategies like
632633
:class:`Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface`,
633634
register it as a service, then tag it with ``kernel.fragment_renderer``.
634635

636+
kernel.reset
637+
------------
638+
639+
**Purpose**: Clean up services between requests
640+
641+
During the ``kernel.terminate`` event, Symfony looks for any service tagged
642+
with the ``kernel.reset`` tag to reinitialize their state. This is done by
643+
calling to the method whose name is configured in the ``method`` argument of
644+
the tag.
645+
646+
This is mostly useful when running your projects in application servers that
647+
reuse the Symfony application between requests to improve performance. This tag
648+
is applied for example to the built-in :doc:`data collectors </profiler/data_collector>`
649+
of the profiler to delete all their information.
650+
635651
.. _dic_tags-monolog:
636652

637653
monolog.logger

0 commit comments

Comments
 (0)