Normally we set a value against a key in config.yml file and it always stays the same because it is a static file. However, you can set a different value against a key in config.yml file as shown below. This example sets a dynamic value for namespace key in kernel level.


Config.yml


doctrine_cache:
providers:
my_memcached_cache:
#namespace: my_namespace_123 # This would be useless if we wanted a dynamic value
memcached:
servers:
memcached01:
host: %memcache_server%
port: %memcache_port%

DependencyInjection


namespace Application\FrontendBundle\DependencyInjection;

class ApplicationFrontendExtension extends Extension implements PrependExtensionInterface
{
# ...
# ...

public function prepend(ContainerBuilder $container)
{
$container->prependExtensionConfig(
'doctrine_cache',
[
'providers' => [
'my_memcached_cache' => [
'namespace' => sprintf('fws_validation_cache_namespace_%s', time()),
'type' => 'array',
],
],
]
);
}

# ...
# ...
}