Skip to content

Commit 9dd8d96

Browse files
committed
bug #3689 Fix cache warmer description (WouterJ)
This PR was merged into the 2.3 branch. Discussion ---------- Fix cache warmer description | Q | A | --- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | - - The warmers are also executed on the first request: https://github.com/symfony/HttpKernel/blob/master/Kernel.php#L568-571 - Defining optional warmers has some effects, saying it has no effect is wrong. Commits ------- ac0f66d Updated the description of cache warmers
2 parents 6221f35 + ac0f66d commit 9dd8d96

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

reference/dic_tags.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,8 @@ kernel.cache_warmer
406406
**Purpose**: Register your service to be called during the cache warming process
407407
408408
Cache warming occurs whenever you run the ``cache:warmup`` or ``cache:clear``
409-
task (unless you pass ``--no-warmup`` to ``cache:clear``). The purpose is
409+
task (unless you pass ``--no-warmup`` to ``cache:clear``). It is also run when
410+
handling the request, if it wasn't done by one of the commands yet. The purpose is
410411
to initialize any cache that will be needed by the application and prevent
411412
the first user from any significant "cache hit" where the cache is generated
412413
dynamically.
@@ -423,7 +424,7 @@ the :class:`Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface` i
423424
{
424425
public function warmUp($cacheDir)
425426
{
426-
// do some sort of operations to "warm" your cache
427+
// ... do some sort of operations to "warm" your cache
427428
}
428429
429430
public function isOptional()
@@ -433,8 +434,9 @@ the :class:`Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface` i
433434
}
434435
435436
The ``isOptional`` method should return true if it's possible to use the
436-
application without calling this cache warmer. In Symfony 2.0, optional warmers
437-
are always executed anyways, so this function has no real effect.
437+
application without calling this cache warmer. In Symfony, optional warmers
438+
are always executed by default (you can change this by using the
439+
``--no-optional-warmers`` option when executing the command).
438440
439441
To register your warmer with Symfony, give it the ``kernel.cache_warmer`` tag:
440442

0 commit comments

Comments
 (0)