-
-
Notifications
You must be signed in to change notification settings - Fork 932
fix(symfony): metadata cache is broken in dev/prod #4986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.xml
api_platform.cache.metadata.resource
=>metadata/resource_name.xml
api_platform.cache.metadata.resource_collection
=>metadata/resource.xml
api_platform.cache.route_name_resolver
=>metadata/api.xml
api_platform.cache.identifiers_extractor
=> seems unusedapi_platform.elasticsearch.cache.metadata.document
=>elasticsearch.xml
In
ApiPlatformExtension
, these files are loaded inregisterMetadataConfiguration
but then each cache is overrided inregisterCacheConfiguration
for anArrayAdapter
instead of the usualcache.system
.