8000 [Cache] Expand the docs about the cache chain · symfony/symfony-docs@1227f8b · GitHub
[go: up one dir, main page]

Skip to content

Commit 1227f8b

Browse files
committed
[Cache] Expand the docs about the cache chain
1 parent df13346 commit 1227f8b

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

cache.rst

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,11 +397,21 @@ and use that when configuring the pool.
397397
Creating a Cache Chain
398398
----------------------
399399

400-
Different cache adapters have different strengths and weaknesses. Some might be really
401-
quick but small and some may be able to contain a lot of data but are quite slow.
402-
To get the best of both worlds you may use a chain of adapters. The idea is to
403-
first look at the quick adapter and then move on to slower adapters. In the worst
404-
case the value needs to be recalculated.
400+
Different cache adapters have different strengths and weaknesses. Some might be
401+
really quick but optimized to store small items and some may be able to contain
402+
a lot of data but are quite slow. To get the best of both worlds you may use a
403+
chain of adapters.
404+
405+
A cache chain combines several cache pools into a single one. When storing an
406+
item in a cache chain, Symfony stores it in all pools sequentially. When
407+
retrieving an item, Symfony tries to get it from the first pool. If it's not
408+
found, it tries the next pools until the item is found or an exception is thrown.
409+
Because of this behavior, it's recommended to define the adapters in the chain
410+
in order from the fastest to the slowest.
411+
412+
If an error happens when storing an item in a pool, Symfony stores it in the
413+
other pools and no exception is thrown. Later, when the item is retrieved,
414+
Symfony stores the item automatically in all the missing pools.
405415

406416
.. configuration-block::
407417

0 commit comments

Comments
 (0)
0