@@ -73,10 +73,11 @@ adapter (template) they use by using the ``app`` and ``system`` key like:
73
73
xsi : schemaLocation =" http://symfony.com/schema/dic/services
74
74
https://symfony.com/schema/dic/services/services-1.0.xsd
75
75
http://symfony.com/schema/dic/symfony
76
- https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
77
-
76
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
77
+ >
78
78
<framework : config >
79
- <framework : cache app =" cache.adapter.filesystem"
79
+ <framework : cache
80
+ app =" cache.adapter.filesystem"
80
81
system =" cache.adapter.system"
81
82
/>
82
83
</framework : config >
@@ -94,7 +95,6 @@ adapter (template) they use by using the ``app`` and ``system`` key like:
94
95
;
95
96
};
96
97
97
-
98
98
The Cache component comes with a series of adapters pre-configured:
99
99
100
100
* :doc: `cache.adapter.apcu </components/cache/adapters/apcu_adapter >`
@@ -137,8 +137,8 @@ will create pools with service IDs that follow the pattern ``cache.[type]``.
137
137
xsi : schemaLocation =" http://symfony.com/schema/dic/services
138
138
https://symfony.com/schema/dic/services/services-1.0.xsd
139
139
http://symfony.com/schema/dic/symfony
140
- https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
141
-
140
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
141
+ >
142
142
<framework : config >
143
143
<!--
144
144
default_psr6_provider: Service: cache.psr6
@@ -229,8 +229,8 @@ You can also create more customized pools:
229
229
xsi : schemaLocation =" http://symfony.com/schema/dic/services
230
230
https://symfony.com/schema/dic/services/services-1.0.xsd
231
231
http://symfony.com/schema/dic/symfony
232
- https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
233
-
232
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
233
+ >
234
234
<framework : config >
235
235
<framework : cache default-memcached-provider =" memcached://localhost" >
236
236
<!-- creates a "custom_thing.cache" service
@@ -331,6 +331,8 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or
331
331
332
332
# config/services.yaml
333
333
services :
334
+ # ...
335
+
334
336
app.cache.adapter.redis :
335
337
parent : ' cache.adapter.redis'
336
338
tags :
@@ -343,9 +345,11 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or
343
345
<container xmlns =" http://symfony.com/schema/dic/services"
344
346
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
345
347
xsi : schemaLocation =" http://symfony.com/schema/dic/services
346
- https://symfony.com/schema/dic/services/services-1.0.xsd" >
347
-
348
+ https://symfony.com/schema/dic/services/services-1.0.xsd"
349
+ >
348
350
<services >
351
+ <!-- ... -->
352
+
349
353
<service id =" app.cache.adapter.redis" parent =" cache.adapter.redis" >
350
354
<tag name =" cache.pool" namespace =" my_custom_namespace" />
351
355
</service >
@@ -357,12 +361,14 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or
357
361
// config/services.php
358
362
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
359
363
360
- return function(ContainerConfigurator $configurator) {
361
- $services = $configurator->services();
364
+ return function(ContainerConfigurator $container) {
365
+ $container->services()
366
+ // ...
362
367
363
- $services->set('app.cache.adapter.redis')
364
- ->parent('cache.adapter.redis')
365
- ->tag('cache.pool', ['namespace' => 'my_custom_namespace']);
368
+ ->set('app.cache.adapter.redis')
369
+ ->parent('cache.adapter.redis')
370
+ ->tag('cache.pool', ['namespace' => 'my_custom_namespace'])
371
+ ;
366
372
};
367
373
368
374
Custom Provider Options
@@ -404,11 +410,14 @@ and use that when configuring the pool.
404
410
xsi : schemaLocation =" http://symfony.com/schema/dic/services
405
411
https://symfony.com/schema/dic/services/services-1.0.xsd
406
412
http://symfony.com/schema/dic/symfony
407
- https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
408
-
413
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
414
+ >
409
415
<framework : config >
410
416
<framework : cache >
411
- <framework : pool name =" cache.my_redis" adapter =" cache.adapter.redis" provider =" app.my_custom_redis_provider" />
417
+ <framework : pool name =" cache.my_redis"
418
+ adapter =" cache.adapter.redis"
419
+ provider =" app.my_custom_redis_provider"
420
+ />
412
421
</framework : cache >
413
422
</framework : config >
414
423
@@ -427,6 +436,8 @@ and use that when configuring the pool.
427
436
.. code-block :: php
428
437
429
438
// config/packages/cache.php
439
+ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
440
+
430
441
use Symfony\Component\Cache\Adapter\RedisAdapter;
431
442
use Symfony\Component\DependencyInjection\ContainerBuilder;
432
443
use Symfony\Config\FrameworkConfig;
@@ -490,11 +501,14 @@ Symfony stores the item automatically in all the missing pools.
490
501
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
491
502
xmlns : framework =" http://symfony.com/schema/dic/symfony"
492
503
xsi : schemaLocation =" http://symfony.com/schema/dic/services
493
- https://symfony.com/schema/dic/services/services-1.0.xsd" >
494
-
504
+ https://symfony.com/schema/dic/services/services-1.0.xsd
505
+ http://symfony.com/schema/dic/symfony
506
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
507
+ >
495
508
<framework : config >
496
509
<framework : cache >
497
- <framework : pool name =" my_cache_pool" default-lifetime =" 31536000" >
510
+ <framework : pool name =" my_cache_pool"
511
+ default-lifetime =" 31536000" > <!-- One year -->
498
512
<framework : adapter name =" cache.adapter.array" />
499
513
<framework : adapter name =" cache.adapter.apcu" />
500
514
<framework : adapter name =" cache.adapter.redis" provider =" redis://user:password@example.com" />
@@ -585,11 +599,14 @@ to enable this feature. This could be added by using the following configuration
585
599
xsi : schemaLocation =" http://symfony.com/schema/dic/services
586
600
https://symfony.com/schema/dic/services/services-1.0.xsd
587
601
http://symfony.com/schema/dic/symfony
588
- https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
589
-
602
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
603
+ >
590
604
<framework : config >
591
605
<framework : cache >
592
- <framework : pool name =" my_cache_pool" adapter =" cache.adapter.redis" tags =" true" />
606
+ <framework : pool name =" my_cache_pool"
607
+ adapter =" cache.adapter.redis"
608
+ tags =" true"
609
+ />
593
610
</framework : cache >
594
611
</framework : config >
595
612
</container >
@@ -633,12 +650,17 @@ achieved by specifying the adapter.
633
650
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
634
651
xmlns : framework =" http://symfony.com/schema/dic/symfony"
635
652
xsi : schemaLocation =" http://symfony.com/schema/dic/services
636
- https://symfony.com/schema/dic/services/services-1.0.xsd" >
637
-
653
+ https://symfony.com/schema/dic/services/services-1.0.xsd
654
+ http://symfony.com/schema/dic/symfony
655
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
656
+ >
638
657
<framework : config >
639
658
<framework : cache >
640
- <framework : pool name =" my_cache_pool" adapter =" cache.adapter.redis" tags =" tag_pool" />
641
- <framework : pool name =" tag_pool" adapter =" cache.adapter.apcu" />
659
+ <framework : pool name =" my_cache_pool"
660
+ adapter =" cache.adapter.redis"
661
+ tags =" tag_pool"
662
+ />
663
+ <framework : pool name =" tag_pool" adapter =" cache.adapter.apcu" />
642
664
</framework : cache >
643
665
</framework : config >
644
666
</container >
0 commit comments