fix(symfony): metadata cache is broken in dev/prod#4986
Conversation
|
Thing is, in development mode we want symfony to clear the cache based on the mtime. Maybe that we should use ArrayAdapter only in development ? I must say I'm not that familiar with how Symfony handles cache. |
But currently this destroys non debug environment. I updated my PR to only target non debug envs. For debug env, it hurts a lot. I overrided api platform caches to go to the filesystem and will cache clear when my schema will change. To add to the strangeness, It:
So we store the metadatas in 2 stores for no real benefit. A clean solution could be to remove this
|
But symfony already has this on |
|
Symfony cannot tell that the cache used for I'm ok to work on improving the dev cache (probably by testing performances first). Maybe in another PR? |
|
As @emmanuelballery I'll remove the localCache from CachedResourceMetadataCollectionFactory (and so add symfony/cache as dependancy in require, instead current require-dev) A distinct cache 'api_platform' (extends app.system) could be maybe added to the default app & system, to avoid modifying other use of the cache.system like above. |
|
As I mentionned in the related issue, you don't have to change the |
|
Hitting a local cache in memory will always be faster than calling the cache component. I would keep it (we also follow the same pattern in Symfony components btw). |
I agree and I do it myself. But If ApiPlatform forces the cache to be an I did suggest to change things around the cache but the main concern of this PR is that v3 is not production ready as is. I tried to route these cache changes in another PR, but failed. We are all - myself included - speaking of improvements when the real current fix is not pushed yet. I'd suggest to focus on fixing non debug environments (or prod) here, which my commit does; and I'll happily bench the chain of |
Hi!
Cache seems broken in 3.0.0. Metadatas are not stored in the filesystem nor in APCu, resulting in poor performances (see #4975 (comment)).
Cache services are provided by each metadata XML file located in
src/Symfony/Bundle/Resources/config/.api_platform.cache.metadata.property=>metadata/property.xmlapi_platform.cache.metadata.resource=>metadata/resource_name.xmlapi_platform.cache.metadata.resource_collection=>metadata/resource.xmlapi_platform.cache.route_name_resolver=>metadata/api.xmlapi_platform.cache.identifiers_extractor=> seems unusedapi_platform.elasticsearch.cache.metadata.document=>elasticsearch.xmlIn
ApiPlatformExtension, these files are loaded inregisterMetadataConfigurationbut then each cache is overrided inregisterCacheConfigurationfor anArrayAdapterinstead of the usualcache.system.