@@ -329,6 +329,53 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or
329
329
// ...
330
330
}
331
331
332
+ .. tip ::
333
+
334
+ If you need the namespace to be interoperable with a third-party app,
335
+ you can take control over auto-generation by setting the ``namespace ``
336
+ attribute of the ``cache.pool `` service tag. For example, you can
337
+ override the service definition of the adapter:
338
+
339
+ .. configuration-block ::
340
+
341
+ .. code-block :: yaml
342
+
343
+ # config/services.yaml
344
+ services :
345
+ app.cache.adapter.redis :
346
+ parent : ' cache.adapter.redis'
347
+ tags :
348
+ - { name: 'cache.pool', namespace: 'my_custom_namespace' }
349
+
350
+ .. code-block :: xml
351
+
352
+ <!-- config/services.xml -->
353
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
354
+ <container xmlns =" http://symfony.com/schema/dic/services"
355
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
356
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
357
+ https://symfony.com/schema/dic/services/services-1.0.xsd" >
358
+
359
+ <services >
360
+ <service id =" app.cache.adapter.redis" parent =" cache.adapter.redis" >
361
+ <tag name =" cache.pool" namespace =" my_custom_namespace" />
362
+ </service >
363
+ </services >
364
+ </container >
365
+
366
+ .. code-block :: php
367
+
368
+ // config/services.php
369
+ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
370
+
371
+ return function(ContainerConfigurator $configurator) {
372
+ $services = $configurator->services();
373
+
374
+ $services->set('app.cace.adapter.redis')
375
+ ->parent('cache.adapter.redis')
376
+ ->tag('cache.pool', ['namespace' => 'my_custom_namespace'])
377
+ };
378
+
332
379
Custom Provider Options
333
380
-----------------------
334
381
0 commit comments