Skip to content

Commit 3a5ee29

Browse files
committed
Merge branch '5.0'
* 5.0: [Cache] Fixed a minor RST syntax issue [Cache] Expand the docs about the cache chain Explain the prefix used for expressions in YAML files Minor tweak in a security expression explanation
2 parents 4653d76 + e886e07 commit 3a5ee29

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

cache.rst

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,21 @@ and use that when configuring the pool.
370370
Creating a Cache Chain
371371
----------------------
372372

373-
Different cache adapters have different strengths and weaknesses. Some might be really
374-
quick but small and some may be able to contain a lot of data but are quite slow.
375-
To get the best of both worlds you may use a chain of adapters. The idea is to
376-
first look at the quick adapter and then move on to slower adapters. In the worst
377-
case the value needs to be recalculated.
373+
Different cache adapters have different strengths and weaknesses. Some might be
374+
really quick but optimized to store small items and some may be able to contain
375+
a lot of data but are quite slow. To get the best of both worlds you may use a
376+
chain of adapters.
377+
378+
A cache chain combines several cache pools into a single one. When storing an
379+
item in a cache chain, Symfony stores it in all pools sequentially. When
380+
retrieving an item, Symfony tries to get it from the first pool. If it's not
381+
found, it tries the next pools until the item is found or an exception is thrown.
382+
Because of this behavior, it's recommended to define the adapters in the chain
383+
in order from the fastest to the slowest.
384+
385+
If an error happens when storing an item in a pool, Symfony stores it in the
386+
other pools and no exception is thrown. Later, when the item is retrieved,
387+
Symfony stores the item automatically in all the missing pools.
378388

379389
.. configuration-block::
380390

@@ -470,7 +480,7 @@ the same key could be invalidate with one function call::
470480
}
471481
}
472482

473-
The cache adapter needs to implement :class:`Symfony\\Contracts\\Cache\\TagAwareCacheInterface``
483+
The cache adapter needs to implement :class:`Symfony\\Contracts\\Cache\\TagAwareCacheInterface`
474484
to enable this feature. This could be added by using the following configuration.
475485

476486
.. configuration-block::

security/expressions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ Inside the expression, you have access to a number of variables:
3939
``user``
4040
The user object (or the string ``anon`` if you're not authenticated).
4141
``roles``
42-
The array of roles the user has, including from the
43-
:ref:`role hierarchy <security-role-hierarchy>` but not including the
44-
``IS_AUTHENTICATED_*`` attributes (see the functions below).
42+
The array of roles the user has. This array includes any roles granted
43+
indirectly via the :ref:`role hierarchy <security-role-hierarchy>` but it
44+
does not include the ``IS_AUTHENTICATED_*`` attributes (see the functions below).
4545
``object``
4646
The object (if any) that's passed as the second argument to ``isGranted()``.
4747
``token``

service_container/expression_language.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ to another service: ``App\Mailer``. One way to do this is with an expression:
2828
App\Mail\MailerConfiguration: ~
2929
3030
App\Mailer:
31+
# the '@=' prefix is required when using expressions for arguments in YAML files
3132
arguments: ['@=service("App\\Mail\\MailerConfiguration").getMailerMethod()']
3233
# when using double-quoted strings, the backslash needs to be escaped twice (see https://yaml.org/spec/1.2/spec.html#id2787109)
3334
# arguments: ["@=service('App\\\\Mail\\\\MailerConfiguration').getMailerMethod()"]
@@ -89,6 +90,7 @@ via a ``container`` variable. Here's another example:
8990
# config/services.yaml
9091
services:
9192
App\Mailer:
93+
# the '@=' prefix is required when using expressions for arguments in YAML files
9294
arguments: ["@=container.hasParameter('some_param') ? parameter('some_param') : 'default_value'"]
9395
9496
.. code-block:: xml

0 commit comments

Comments
 (0)