@@ -78,10 +78,11 @@ adapter (template) they use by using the ``app`` and ``system`` key like:
78
78
xsi : schemaLocation =" http://symfony.com/schema/dic/services
79
79
https://symfony.com/schema/dic/services/services-1.0.xsd
80
80
http://symfony.com/schema/dic/symfony
81
- https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
82
-
81
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
82
+ >
83
83
<framework : config >
84
- <framework : cache app =" cache.adapter.filesystem"
84
+ <framework : cache
85
+ app =" cache.adapter.filesystem"
85
86
system =" cache.adapter.system"
86
87
/>
87
88
</framework : config >
@@ -99,7 +100,6 @@ adapter (template) they use by using the ``app`` and ``system`` key like:
99
100
;
100
101
};
101
102
102
-
103
103
The Cache component comes with a series of adapters pre-configured:
104
104
105
105
* :doc: `cache.adapter.apcu </components/cache/adapters/apcu_adapter >`
@@ -149,8 +149,8 @@ will create pools with service IDs that follow the pattern ``cache.[type]``.
149
149
xsi : schemaLocation =" http://symfony.com/schema/dic/services
150
150
https://symfony.com/schema/dic/services/services-1.0.xsd
151
151
http://symfony.com/schema/dic/symfony
152
- https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
153
-
152
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
153
+ >
154
154
<framework : config >
155
155
<!--
156
156
default_doctrine_provider: Service: cache.doctrine
@@ -250,8 +250,8 @@ You can also create more customized pools:
250
250
xsi : schemaLocation =" http://symfony.com/schema/dic/services
251
251
https://symfony.com/schema/dic/services/services-1.0.xsd
252
252
http://symfony.com/schema/dic/symfony
253
- https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
254
-
253
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
254
+ >
255
255
<framework : config >
256
256
<framework : cache default-memcached-provider =" memcached://localhost" >
257
257
<!-- creates a "custom_thing.cache" service
@@ -352,6 +352,8 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or
352
352
353
353
# config/services.yaml
354
354
services :
355
+ # ...
356
+
355
357
app.cache.adapter.redis :
356
358
parent : ' cache.adapter.redis'
357
359
tags :
@@ -364,9 +366,11 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or
364
366
<container xmlns =" http://symfony.com/schema/dic/services"
365
367
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
366
368
xsi : schemaLocation =" http://symfony.com/schema/dic/services
367
- https://symfony.com/schema/dic/services/services-1.0.xsd" >
368
-
369
+ https://symfony.com/schema/dic/services/services-1.0.xsd"
370
+ >
369
371
<services >
372
+ <!-- ... -->
373
+
370
374
<service id =" app.cache.adapter.redis" parent =" cache.adapter.redis" >
371
375
<tag name =" cache.pool" namespace =" my_custom_namespace" />
372
376
</service >
@@ -378,12 +382,14 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or
378
382
// config/services.php
379
383
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
380
384
381
- return function(ContainerConfigurator $configurator) {
382
- $services = $configurator->services();
385
+ return function(ContainerConfigurator $container) {
386
+ $container->services()
387
+ // ...
383
388
384
- $services->set('app.cache.adapter.redis')
385
- ->parent('cache.adapter.redis')
386
- ->tag('cache.pool', ['namespace' => 'my_custom_namespace']);
389
+ ->set('app.cache.adapter.redis')
390
+ ->parent('cache.adapter.redis')
391
+ ->tag('cache.pool', ['namespace' => 'my_custom_namespace'])
392
+ ;
387
393
};
388
394
389
395
Custom Provider Options
@@ -425,11 +431,14 @@ and use that when configuring the pool.
425
431
xsi : schemaLocation =" http://symfony.com/schema/dic/services
426
432
https://symfony.com/schema/dic/services/services-1.0.xsd
427
433
http://symfony.com/schema/dic/symfony
428
- https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
429
-
434
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
435
+ >
430
436
<framework : config >
431
437
<framework : cache >
432
- <framework : pool name =" cache.my_redis" adapter =" cache.adapter.redis" provider =" app.my_custom_redis_provider" />
438
+ <framework : pool name =" cache.my_redis"
439
+ adapter =" cache.adapter.redis"
440
+ provider =" app.my_custom_redis_provider"
441
+ />
433
442
</framework : cache >
434
443
</framework : config >
435
444
@@ -448,6 +457,8 @@ and use that when configuring the pool.
448
457
.. code-block :: php
449
458
450
459
// config/packages/cache.php
460
+ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
461
+
451
462
use Symfony\Component\Cache\Adapter\RedisAdapter;
452
463
use Symfony\Component\DependencyInjection\ContainerBuilder;
453
464
use Symfony\Config\FrameworkConfig;
@@ -511,11 +522,14 @@ Symfony stores the item automatically in all the missing pools.
511
522
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
512
523
xmlns : framework =" http://symfony.com/schema/dic/symfony"
513
524
xsi : schemaLocation =" http://symfony.com/schema/dic/services
514
- https://symfony.com/schema/dic/services/services-1.0.xsd" >
515
-
525
+ https://symfony.com/schema/dic/services/services-1.0.xsd
526
+ http://symfony.com/schema/dic/symfony
527
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
528
+ >
516
529
<framework : config >
517
530
<framework : cache >
518
- <framework : pool name =" my_cache_pool" default-lifetime =" 31536000" >
531
+ <framework : pool name =" my_cache_pool"
532
+ default-lifetime =" 31536000" > <!-- One year -->
519
533
<framework : adapter name =" cache.adapter.array" />
520
534
<framework : adapter name =" cache.adapter.apcu" />
521
535
<framework : adapter name =" cache.adapter.redis" provider =" redis://user:password@example.com" />
@@ -606,11 +620,14 @@ to enable this feature. This could be added by using the following configuration
606
620
xsi : schemaLocation =" http://symfony.com/schema/dic/services
607
621
https://symfony.com/schema/dic/services/services-1.0.xsd
608
622
http://symfony.com/schema/dic/symfony
609
- https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
610
-
623
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
624
+ >
611
625
<framework : config >
612
626
<framework : cache >
613
- <framework : pool name =" my_cache_pool" adapter =" cache.adapter.redis" tags =" true" />
627
+ <framework : pool name =" my_cache_pool"
628
+ adapter =" cache.adapter.redis"
629
+ tags =" true"
630
+ />
614
631
</framework : cache >
615
632
</framework : config >
616
633
</container >
@@ -654,12 +671,17 @@ achieved by specifying the adapter.
654
671
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
655
672
xmlns : framework =" http://symfony.com/schema/dic/symfony"
656
673
xsi : schemaLocation =" http://symfony.com/schema/dic/services
657
- https://symfony.com/schema/dic/services/services-1.0.xsd" >
658
-
674
+ https://symfony.com/schema/dic/services/services-1.0.xsd
675
+ http://symfony.com/schema/dic/symfony
676
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
677
+ >
659
678
<framework : config >
660
679
<framework : cache >
661
- <framework : pool name =" my_cache_pool" adapter =" cache.adapter.redis" tags =" tag_pool" />
662
- <framework : pool name =" tag_pool" adapter =" cache.adapter.apcu" />
680
+ <framework : pool name =" my_cache_pool"
681
+ adapter =" cache.adapter.redis"
682
+ tags =" tag_pool"
683
+ />
684
+ <framework : pool name =" tag_pool" adapter =" cache.adapter.apcu" />
663
685
</framework : cache >
664
686
</framework : config >
665
687
</container >
0 commit comments