@@ -385,16 +385,22 @@ case the value needs to be recalculated.
385385 cache :
386386 pools :
387387 my_cache_pool :
388- adapter : app.my_cache_chain_adapter
388+ adapter : cache.adapter.psr6
389+ provider : app.my_cache_chain_adapter
389390 cache.my_redis :
390391 adapter : cache.adapter.redis
391392 provider : ' redis://user:password@example.com'
393+ cache.apcu :
394+ adapter : cache.adapter.apcu
395+ cache.array :
396+ adapter : cache.adapter.array
397+
392398
393399 services :
394400 app.my_cache_chain_adapter :
395401 class : Symfony\Component\Cache\Adapter\ChainAdapter
396402 arguments :
397- - ['cache.adapter. array', 'cache.my_redis ', 'cache.adapter.file ']
403+ - ['@ cache.array', '@ cache.apcu ', '@ cache.my_redis ']
398404 - 31536000 # One year
399405
400406 .. code-block :: xml
@@ -409,17 +415,19 @@ case the value needs to be recalculated.
409415
410416 <framework : config >
411417 <framework : cache >
412- <framework : pool name =" my_cache_pool" adapter =" app.my_cache_chain_adapter" />
418+ <framework : pool name =" my_cache_pool" adapter =" cache.adapter.psr6 " provider = " app.my_cache_chain_adapter" />
413419 <framework : pool name =" cache.my_redis" adapter =" cache.adapter.redis" provider =" redis://user:password@example.com" />
420+ <framework : pool name =" cache.apcu" adapter =" cache.adapter.apcu" />
421+ <framework : pool name =" cache.array" adapter =" cache.adapter.array" />
414422 </framework : cache >
415423 </framework : config >
416424
417425 <services >
418426 <service id =" app.my_cache_chain_adapter" class =" Symfony\Component\Cache\Adapter\ChainAdapter" >
419427 <argument type =" collection" >
420- <argument type =" service" value =" cache.adapter.array" />
428+ <argument type =" service" value =" cache.array" />
429+ <argument type =" service" value =" cache.apcu" />
421430 <argument type =" service" value =" cache.my_redis" />
422- <argument type =" service" value =" cache.adapter.file" />
423431 </argument >
424432 <argument >31536000</argument >
425433 </service >
@@ -433,28 +441,37 @@ case the value needs to be recalculated.
433441 'cache' => [
434442 'pools' => [
435443 'my_cache_pool' => [
436- 'adapter' => 'app.my_cache_chain_adapter',
444+ 'adapter' => 'cache.adapter.psr6',
445+ 'provider' => 'app.my_cache_chain_adapter',
437446 ],
438447 'cache.my_redis' => [
439448 'adapter' => 'cache.adapter.redis',
440449 'provider' => 'redis://user:password@example.com',
441450 ],
451+ 'cache.apcu' => [
452+ 'adapter' => 'cache.adapter.apcu',
453+ ],
454+ 'cache.array' => [
455+ 'adapter' => 'cache.adapter.array',
456+ ],
442457 ],
443458 ],
444459 ]);
445460
446461 $container->getDefinition('app.my_cache_chain_adapter', \Symfony\Component\Cache\Adapter\ChainAdapter::class)
447462 ->addArgument([
448- new Reference('cache.adapter.array'),
463+ new Reference('cache.array'),
464+ new Reference('cache.apcu'),
449465 new Reference('cache.my_redis'),
450- new Reference('cache.adapter.file'),
451466 ])
452467 ->addArgument(31536000);
453468
454469 .. note ::
455470
456- In this configuration there is a ``cache.my_redis `` pool that is used as an
457- adapter in the ``app.my_cache_chain_adapter ``
471+ In this configuration the ``my_cache_pool `` pool is using the ``cache.adapter.psr6 ``
472+ adapter and the ``app.my_cache_chain_adapter `` service as a provider. That is
473+ because ``ChainAdapter `` does not support the ``cache.pool `` tag. So it is decorated
474+ with the ``ProxyAdapter ``.
458475
459476
460477Using Cache Tags
0 commit comments