@@ -385,16 +385,22 @@ case the value needs to be recalculated.
385
385
cache :
386
386
pools :
387
387
my_cache_pool :
388
- adapter : app.my_cache_chain_adapter
388
+ adapter : cache.adapter.psr6
389
+ provider : app.my_cache_chain_adapter
389
390
cache.my_redis :
390
391
adapter : cache.adapter.redis
391
392
provider : ' redis://user:[email protected] '
393
+ cache.apcu :
394
+ adapter : cache.adapter.apcu
395
+ cache.array :
396
+ adapter : cache.adapter.array
397
+
392
398
393
399
services :
394
400
app.my_cache_chain_adapter :
395
401
class : Symfony\Component\Cache\Adapter\ChainAdapter
396
402
arguments :
397
- - ['cache.adapter. array', 'cache.my_redis ', 'cache.adapter.file ']
403
+ - ['@ cache.array', '@ cache.apcu ', '@ cache.my_redis ']
398
404
- 31536000 # One year
399
405
400
406
.. code-block :: xml
@@ -409,17 +415,19 @@ case the value needs to be recalculated.
409
415
410
416
<framework : config >
411
417
<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" />
413
419
<framework : pool name =" cache.my_redis" adapter =" cache.adapter.redis" provider =" redis://user:[email protected] " />
420
+ <framework : pool name =" cache.apcu" adapter =" cache.adapter.apcu" />
421
+ <framework : pool name =" cache.array" adapter =" cache.adapter.array" />
414
422
</framework : cache >
415
423
</framework : config >
416
424
417
425
<services >
418
426
<service id =" app.my_cache_chain_adapter" class =" Symfony\Component\Cache\Adapter\ChainAdapter" >
419
427
<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" />
421
430
<argument type =" service" value =" cache.my_redis" />
422
- <argument type =" service" value =" cache.adapter.file" />
423
431
</argument >
424
432
<argument >31536000</argument >
425
433
</service >
@@ -433,28 +441,37 @@ case the value needs to be recalculated.
433
441
'cache' => [
434
442
'pools' => [
435
443
'my_cache_pool' => [
436
- 'adapter' => 'app.my_cache_chain_adapter',
444
+ 'adapter' => 'cache.adapter.psr6',
445
+ 'provider' => 'app.my_cache_chain_adapter',
437
446
],
438
447
'cache.my_redis' => [
439
448
'adapter' => 'cache.adapter.redis',
440
449
'provider' => 'redis://user:[email protected] ',
441
450
],
451
+ 'cache.apcu' => [
452
+ 'adapter' => 'cache.adapter.apcu',
453
+ ],
454
+ 'cache.array' => [
455
+ 'adapter' => 'cache.adapter.array',
456
+ ],
442
457
],
443
458
],
444
459
]);
445
460
446
461
$container->getDefinition('app.my_cache_chain_adapter', \Symfony\Component\Cache\Adapter\ChainAdapter::class)
447
462
->addArgument([
448
- new Reference('cache.adapter.array'),
463
+ new Reference('cache.array'),
464
+ new Reference('cache.apcu'),
449
465
new Reference('cache.my_redis'),
450
- new Reference('cache.adapter.file'),
451
466
])
452
467
->addArgument(31536000);
453
468
454
469
.. note ::
455
470
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 ``.
458
475
459
476
460
477
Using Cache Tags
0 commit comments