[FrameworkBundle] Cache the serializer metadata in debug mode when it comes from mapping files
Metadata read from attributes must be rebuilt on every request in debug mode, because the container knows nothing about the classes it is read from. Metadata read from mapping files does not: the container can depend on these files and be rebuilt when one of them changes. Three things were missing for that to work: * the mapping files were not tracked as container resources, so editing one did not rebuild the container; * the metadata was stored in a PHP file written by an optional cache warmer, which does not run when the container is rebuilt while handling a request, so the file stayed stale. In debug mode the metadata now goes to the "cache.serializer" pool instead, which is cleared on every rebuild; * the warmer that clears that pool was only registered together with the profiler. It is now registered whenever debug mode is on. On an application with 83 mapping files, the first serialization of a request goes from about 140 ms to about 1 ms.
N
Nicolas Grekas committed
32eb84b62daba1615d4d3b2afe82e16f2b461c95
Parent: d2b51d1