@@ -65,7 +65,9 @@ adapter (template) they use by using the ``app`` and ``system`` key like:
65
65
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
66
66
xmlns : framework =" http://symfony.com/schema/dic/symfony"
67
67
xsi : schemaLocation =" http://symfony.com/schema/dic/services
68
- https://symfony.com/schema/dic/services/services-1.0.xsd" >
68
+ https://symfony.com/schema/dic/services/services-1.0.xsd
69
+ http://symfony.com/schema/dic/symfony
70
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
69
71
70
72
<framework : config >
71
73
<framework : cache app =" cache.adapter.filesystem"
@@ -133,7 +135,9 @@ will create pool with service id of ``cache.[type]``
133
135
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
134
136
xmlns : framework =" http://symfony.com/schema/dic/symfony"
135
137
xsi : schemaLocation =" http://symfony.com/schema/dic/services
136
- https://symfony.com/schema/dic/services/services-1.0.xsd" >
138
+ https://symfony.com/schema/dic/services/services-1.0.xsd
139
+ http://symfony.com/schema/dic/symfony
140
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
137
141
138
142
<framework : config >
139
143
<!--
@@ -143,6 +147,7 @@ will create pool with service id of ``cache.[type]``
143
147
default_memcached_provider: Service: cache.memcached
144
148
default_pdo_provider: Service: cache.pdo
145
149
-->
150
+ <!-- "directory" attribute is only used with cache.adapter.filesystem -->
146
151
<framework : cache directory =" %kernel.cache_dir%/pools"
147
152
default_doctrine_provider =" app.doctrine_cache"
148
153
default_psr6_provider =" app.my_psr6_service"
@@ -204,7 +209,9 @@ You can also create more customized pools. All you need is an adapter:
204
209
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
205
210
xmlns : framework =" http://symfony.com/schema/dic/symfony"
206
211
xsi : schemaLocation =" http://symfony.com/schema/dic/services
207
- https://symfony.com/schema/dic/services/services-1.0.xsd" >
212
+ https://symfony.com/schema/dic/services/services-1.0.xsd
213
+ http://symfony.com/schema/dic/symfony
214
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
208
215
209
216
<framework : config >
210
217
<framework : cache default_memcached_provider =" memcached://localhost" >
@@ -276,7 +283,9 @@ For advanced configurations it could sometimes be useful to use a pool as an ada
276
283
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
277
284
xmlns : framework =" http://symfony.com/schema/dic/symfony"
278
285
xsi : schemaLocation =" http://symfony.com/schema/dic/services
279
- https://symfony.com/schema/dic/services/services-1.0.xsd" >
286
+ https://symfony.com/schema/dic/services/services-1.0.xsd
287
+ http://symfony.com/schema/dic/symfony
288
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
280
289
281
290
<framework : config >
282
291
<framework : cache app =" my_cache_pool" >
@@ -354,7 +363,9 @@ and use that when configuring the pool.
354
363
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
355
364
xmlns : framework =" http://symfony.com/schema/dic/symfony"
356
365
xsi : schemaLocation =" http://symfony.com/schema/dic/services
357
- https://symfony.com/schema/dic/services/services-1.0.xsd" >
366
+ https://symfony.com/schema/dic/services/services-1.0.xsd
367
+ http://symfony.com/schema/dic/symfony
368
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
358
369
359
370
<framework : config >
360
371
<framework : cache >
@@ -364,6 +375,7 @@ and use that when configuring the pool.
364
375
365
376
<services >
366
377
<service id =" app.my_custom_redis_provider" class =" \Redis" >
378
+ <factory class =" Symfony\Component\Cache\Adapter\RedisAdapter" method =" createConnection" />
367
379
<argument >redis://localhost</argument >
368
380
<argument type =" collection" >
369
381
<argument key =" retry_interval" >2</argument >
@@ -376,6 +388,8 @@ and use that when configuring the pool.
376
388
.. code-block :: php
377
389
378
390
// app/config/config.php
391
+ use Symfony\Component\Cache\Adapter\RedisAdapter;
392
+
379
393
$container->loadFromExtension('framework', [
380
394
'cache' => [
381
395
'pools' => [
@@ -387,12 +401,14 @@ and use that when configuring the pool.
387
401
],
388
402
]);
389
403
390
- $container->getDefinition('app.my_custom_redis_provider', \Redis::class)
404
+ $container->register('app.my_custom_redis_provider', \Redis::class)
405
+ ->setFactory([RedisAdapter::class, 'createConnection'])
391
406
->addArgument('redis://localhost')
392
407
->addArgument([
393
408
'retry_interval' => 2,
394
409
'timeout' => 10
395
- ]);
410
+ ])
411
+ ;
396
412
397
413
Creating a Cache Chain
398
414
----------------------
@@ -448,7 +464,9 @@ Symfony stores the item automatically in all the missing pools.
448
464
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
449
465
xmlns : framework =" http://symfony.com/schema/dic/symfony"
450
466
xsi : schemaLocation =" http://symfony.com/schema/dic/services
451
- https://symfony.com/schema/dic/services/services-1.0.xsd" >
467
+ https://symfony.com/schema/dic/services/services-1.0.xsd
468
+ http://symfony.com/schema/dic/symfony
469
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
452
470
453
471
<framework : config >
454
472
<framework : cache >
@@ -474,6 +492,9 @@ Symfony stores the item automatically in all the missing pools.
474
492
.. code-block :: php
475
493
476
494
// app/config/config.php
495
+ use Symfony\Component\Cache\Adapter\ChainAdapter;
496
+ use Symfony\Component\DependencyInjection\Reference;
497
+
477
498
$container->loadFromExtension('framework', [
478
499
'cache' => [
479
500
'pools' => [
@@ -495,13 +516,14 @@ Symfony stores the item automatically in all the missing pools.
495
516
],
496
517
]);
497
518
498
- $container->getDefinition ('app.my_cache_chain_adapter', \Symfony\Component\Cache\Adapter\ ChainAdapter::class)
519
+ $container->register ('app.my_cache_chain_adapter', ChainAdapter::class)
499
520
->addArgument([
500
521
new Reference('cache.array'),
501
522
new Reference('cache.apcu'),
502
523
new Reference('cache.my_redis'),
503
524
])
504
- ->addArgument(31536000);
525
+ ->addArgument(31536000)
526
+ ;
505
527
506
528
.. note ::
507
529
0 commit comments