@@ -389,16 +389,22 @@ case the value needs to be recalculated.
389389 cache :
390390 pools :
391391 my_cache_pool :
392- adapter : app.my_cache_chain_adapter
392+ adapter : cache.adapter.psr6
393+ provider : app.my_cache_chain_adapter
393394 cache.my_redis :
394395 adapter : cache.adapter.redis
395396 provider : ' redis://user:password@example.com'
397+ cache.apcu :
398+ adapter : cache.adapter.apcu
399+ cache.array :
400+ adapter : cache.adapter.array
401+
396402
397403 services :
398404 app.my_cache_chain_adapter :
399405 class : Symfony\Component\Cache\Adapter\ChainAdapter
400406 arguments :
401- - ['cache.adapter. array', 'cache.my_redis ', 'cache.adapter.file ']
407+ - ['@ cache.array', '@ cache.apcu ', '@ cache.my_redis ']
402408 - 31536000 # One year
403409
404410 .. code-block :: xml
@@ -413,17 +419,19 @@ case the value needs to be recalculated.
413419
414420 <framework : config >
415421 <framework : cache >
416- <framework : pool name =" my_cache_pool" adapter =" app.my_cache_chain_adapter" />
422+ <framework : pool name =" my_cache_pool" adapter =" cache.adapter.psr6 " provider = " app.my_cache_chain_adapter" />
417423 <framework : pool name =" cache.my_redis" adapter =" cache.adapter.redis" provider =" redis://user:password@example.com" />
424+ <framework : pool name =" cache.apcu" adapter =" cache.adapter.apcu" />
425+ <framework : pool name =" cache.array" adapter =" cache.adapter.array" />
418426 </framework : cache >
419427 </framework : config >
420428
421429 <services >
422430 <service id =" app.my_cache_chain_adapter" class =" Symfony\Component\Cache\Adapter\ChainAdapter" >
423431 <argument type =" collection" >
424- <argument type =" service" value =" cache.adapter.array" />
432+ <argument type =" service" value =" cache.array" />
433+ <argument type =" service" value =" cache.apcu" />
425434 <argument type =" service" value =" cache.my_redis" />
426- <argument type =" service" value =" cache.adapter.file" />
427435 </argument >
428436 <argument >31536000</argument >
429437 </service >
@@ -437,28 +445,37 @@ case the value needs to be recalculated.
437445 'cache' => [
438446 'pools' => [
439447 'my_cache_pool' => [
440- 'adapter' => 'app.my_cache_chain_adapter',
448+ 'adapter' => 'cache.adapter.psr6',
449+ 'provider' => 'app.my_cache_chain_adapter',
441450 ],
442451 'cache.my_redis' => [
443452 'adapter' => 'cache.adapter.redis',
444453 'provider' => 'redis://user:password@example.com',
445454 ],
455+ 'cache.apcu' => [
456+ 'adapter' => 'cache.adapter.apcu',
457+ ],
458+ 'cache.array' => [
459+ 'adapter' => 'cache.adapter.array',
460+ ],
446461 ],
447462 ],
448463 ]);
449464
450465 $container->getDefinition('app.my_cache_chain_adapter', \Symfony\Component\Cache\Adapter\ChainAdapter::class)
451466 ->addArgument([
452- new Reference('cache.adapter.array'),
467+ new Reference('cache.array'),
468+ new Reference('cache.apcu'),
453469 new Reference('cache.my_redis'),
454- new Reference('cache.adapter.file'),
455470 ])
456471 ->addArgument(31536000);
457472
458473 .. note ::
459474
460- In this configuration there is a ``cache.my_redis `` pool that is used as an
461- adapter in the ``app.my_cache_chain_adapter ``
475+ In this configuration the ``my_cache_pool `` pool is using the ``cache.adapter.psr6 ``
476+ adapter and the ``app.my_cache_chain_adapter `` service as a provider. That is
477+ because ``ChainAdapter `` does not support the ``cache.pool `` tag. So it is decorated
478+ with the ``ProxyAdapter ``.
462479
463480
464481Using Cache Tags
0 commit comments