diff --git a/cache.rst b/cache.rst
index 448b3cd3cf1..6144b470979 100644
--- a/cache.rst
+++ b/cache.rst
@@ -234,7 +234,7 @@ You can also create more customized pools:
-
+
@@ -380,6 +380,10 @@ To get the best of both worlds you may use a chain of adapters. The idea is to
first look at the quick adapter and then move on to slower adapters. In the worst
case the value needs to be recalculated.
+.. versionadded:: 4.4
+
+ Support for configuring a chain using ``framework.cache.pools`` was introduced in Symfony 4.4.
+
.. configuration-block::
.. code-block:: yaml
@@ -389,23 +393,11 @@ case the value needs to be recalculated.
cache:
pools:
my_cache_pool:
- adapter: cache.adapter.psr6
- provider: app.my_cache_chain_adapter
- cache.my_redis:
- adapter: cache.adapter.redis
- provider: 'redis://user:password@example.com'
- cache.apcu:
- adapter: cache.adapter.apcu
- cache.array:
- adapter: cache.adapter.array
-
-
- services:
- app.my_cache_chain_adapter:
- class: Symfony\Component\Cache\Adapter\ChainAdapter
- arguments:
- - ['@cache.array', '@cache.apcu', '@cache.my_redis']
- - 31536000 # One year
+ default_lifetime: 31536000 # One year
+ adapters:
+ - cache.adapter.array
+ - cache.adapter.apcu
+ - {name: cache.adapter.redis, provider: 'redis://user:password@example.com'}
.. code-block:: xml
@@ -419,23 +411,13 @@ case the value needs to be recalculated.
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
- 31536000
-
-
.. code-block:: php
@@ -445,39 +427,17 @@ case the value needs to be recalculated.
'cache' => [
'pools' => [
'my_cache_pool' => [
- 'adapter' => 'cache.adapter.psr6',
- 'provider' => 'app.my_cache_chain_adapter',
- ],
- 'cache.my_redis' => [
- 'adapter' => 'cache.adapter.redis',
- 'provider' => 'redis://user:password@example.com',
- ],
- 'cache.apcu' => [
- 'adapter' => 'cache.adapter.apcu',
- ],
- 'cache.array' => [
- 'adapter' => 'cache.adapter.array',
+ 'default_lifetime' => 31536000, // One year
+ 'adapters' => [
+ 'cache.adapter.array',
+ 'cache.adapter.apcu',
+ ['name' => 'cache.adapter.redis', 'provider' => 'redis://user:password@example.com'],
+ ],
],
],
],
]);
- $container->getDefinition('app.my_cache_chain_adapter', \Symfony\Component\Cache\Adapter\ChainAdapter::class)
- ->addArgument([
- new Reference('cache.array'),
- new Reference('cache.apcu'),
- new Reference('cache.my_redis'),
- ])
- ->addArgument(31536000);
-
-.. note::
-
- In this configuration the ``my_cache_pool`` pool is using the ``cache.adapter.psr6``
- adapter and the ``app.my_cache_chain_adapter`` service as a provider. That is
- because ``ChainAdapter`` does not support the ``cache.pool`` tag. So it is decorated
- with the ``ProxyAdapter``.
-
-
Using Cache Tags
----------------
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy