symfony/symfony — pull request #7781 by mpdude (2013-04-21 21:40:55+00:00)
Title: Delegate creation of ConfigCache instances to a factory.

| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes (refactoring, new flex point)
| BC breaks? | no
| Deprecations? | no
| Tests pass? | we'll see :-)
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a

In the Routing/Router and FrameworkBundle/Translation/Translator, delegate creation of ConfigCache instances to a factory. The factory can be setter-injected but will default to a BC implementation.

The ```ConfigCacheFactoryInterface``` is designed in a way that captures the common ```$cache = new ...; if (!$cache->isFresh()) { ... do sth }``` pattern. But more importantly, this design allows factory implementations to take additional measures to avoid race conditions before actually filling the cache.

Component/HttpKernel/Kernel::initializeContainer still uses the ConfigCache implementation directly as there is no sensible way of getting/injecting a factory service (chicken-egg).