@@ -413,16 +413,22 @@ case the value needs to be recalculated.
413
413
cache :
414
414
pools :
415
415
my_cache_pool :
416
- adapter : app.my_cache_chain_adapter
416
+ adapter : cache.adapter.psr6
417
+ provider : app.my_cache_chain_adapter
417
418
cache.my_redis :
418
419
adapter : cache.adapter.redis
419
420
provider : ' redis://user:[email protected] '
421
+ cache.apcu :
422
+ adapter : cache.adapter.apcu
423
+ cache.array :
424
+ adapter : cache.adapter.array
425
+
420
426
421
427
services :
422
428
app.my_cache_chain_adapter :
423
429
class : Symfony\Component\Cache\Adapter\ChainAdapter
424
430
arguments :
425
- - ['cache.adapter. array', 'cache.my_redis ', 'cache.adapter.file ']
431
+ - ['@ cache.array', '@ cache.apcu ', '@ cache.my_redis ']
426
432
- 31536000 # One year
427
433
428
434
.. code-block :: xml
@@ -436,18 +442,20 @@ case the value needs to be recalculated.
436
442
https://symfony.com/schema/dic/services/services-1.0.xsd" >
437
443
438
444
<framework : config >
439
- <framework : cache default_memcached_provider = " memcached://localhost " >
440
- <framework : pool name =" my_cache_pool" adapter =" app.my_cache_chain_adapter" />
445
+ <framework : cache >
446
+ <framework : pool name =" my_cache_pool" adapter =" cache.adapter.psr6 " provider = " app.my_cache_chain_adapter" />
441
447
<framework : pool name =" cache.my_redis" adapter =" cache.adapter.redis" provider =" redis://user:[email protected] " />
448
+ <framework : pool name =" cache.apcu" adapter =" cache.adapter.apcu" />
449
+ <framework : pool name =" cache.array" adapter =" cache.adapter.array" />
442
450
</framework : cache >
443
451
</framework : config >
444
452
445
453
<services >
446
454
<service id =" app.my_cache_chain_adapter" class =" Symfony\Component\Cache\Adapter\ChainAdapter" >
447
455
<argument type =" collection" >
448
- <argument type =" service" value =" cache.adapter.array" />
456
+ <argument type =" service" value =" cache.array" />
457
+ <argument type =" service" value =" cache.apcu" />
449
458
<argument type =" service" value =" cache.my_redis" />
450
- <argument type =" service" value =" cache.adapter.file" />
451
459
</argument >
452
460
<argument >31536000</argument >
453
461
</service >
@@ -461,28 +469,37 @@ case the value needs to be recalculated.
461
469
'cache' => [
462
470
'pools' => [
463
471
'my_cache_pool' => [
464
- 'adapter' => 'app.my_cache_chain_adapter',
472
+ 'adapter' => 'cache.adapter.psr6',
473
+ 'provider' => 'app.my_cache_chain_adapter',
465
474
],
466
475
'cache.my_redis' => [
467
476
'adapter' => 'cache.adapter.redis',
468
477
'provider' => 'redis://user:[email protected] ',
469
478
],
479
+ 'cache.apcu' => [
480
+ 'adapter' => 'cache.adapter.apcu',
481
+ ],
482
+ 'cache.array' => [
483
+ 'adapter' => 'cache.adapter.array',
484
+ ],
470
485
],
471
486
],
472
487
]);
473
488
474
489
$container->getDefinition('app.my_cache_chain_adapter', \Symfony\Component\Cache\Adapter\ChainAdapter::class)
475
490
->addArgument([
476
- new Reference('cache.adapter.array'),
491
+ new Reference('cache.array'),
492
+ new Reference('cache.apcu'),
477
493
new Reference('cache.my_redis'),
478
- new Reference('cache.adapter.file'),
479
494
])
480
495
->addArgument(31536000);
481
496
482
497
.. note ::
483
498
484
- In this configuration there is a ``cache.my_redis `` pool that is used as an
485
- adapter in the ``app.my_cache_chain_adapter ``
499
+ In this configuration the ``my_cache_pool `` pool is using the ``cache.adapter.psr6 ``
500
+ adapter and the ``app.my_cache_chain_adapter `` service as a provider. That is
501
+ because ``ChainAdapter `` does not support the ``cache.pool `` tag. So it is decorated
502
+ with the ``ProxyAdapter ``.
486
503
487
504
488
505
Clearing the Cache
0 commit comments