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