diff --git a/cache.rst b/cache.rst
index a6435e2e2dd..4044b70f8ef 100644
--- a/cache.rst
+++ b/cache.rst
@@ -413,16 +413,22 @@ case the value needs to be recalculated.
cache:
pools:
my_cache_pool:
- adapter: app.my_cache_chain_adapter
+ 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.adapter.array', 'cache.my_redis', 'cache.adapter.file']
+ - ['@cache.array', '@cache.apcu', '@cache.my_redis']
- 31536000 # One year
.. code-block:: xml
@@ -436,18 +442,20 @@ case the value needs to be recalculated.
https://symfony.com/schema/dic/services/services-1.0.xsd">
-
-
+
+
+
+
-
+
+
-
31536000
@@ -461,28 +469,37 @@ case the value needs to be recalculated.
'cache' => [
'pools' => [
'my_cache_pool' => [
- 'adapter' => 'app.my_cache_chain_adapter',
+ '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',
+ ],
],
],
]);
$container->getDefinition('app.my_cache_chain_adapter', \Symfony\Component\Cache\Adapter\ChainAdapter::class)
->addArgument([
- new Reference('cache.adapter.array'),
+ new Reference('cache.array'),
+ new Reference('cache.apcu'),
new Reference('cache.my_redis'),
- new Reference('cache.adapter.file'),
])
->addArgument(31536000);
.. note::
- In this configuration there is a ``cache.my_redis`` pool that is used as an
- adapter in the ``app.my_cache_chain_adapter``
+ 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``.
Clearing the Cache