8000 [Serializer][Cache] Return dev serializer cache · Issue #42107 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Serializer][Cache] Return dev serializer cache #42107

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

Closed
Foxprodev opened this issue Jul 14, 2021 · 4 comments
Closed

[Serializer][Cache] Return dev serializer cache #42107

Foxprodev opened this issue Jul 14, 2021 · 4 comments

Comments

@Foxprodev
Copy link
Contributor
Foxprodev commented Jul 14, 2021

Description
PR #41961 removed Class metadata cache from development environment (by default), but as @dunglas mentioned in discussion #40034

the dev environnement is already very slow on large projects. I'm not sure if it's a good idea (but I'm not strongly opposed to it either).

I was a little confused, because serializer is very usable feature in API development(and serializer is heart of api-platform).
I have an interactive map application with layer clustering and dynamic layer-in-view loading. Application produces multiple resource requests on each interaction (changing zoom, moving view) and it should be dramatically slow without cache in dev.

So I decided to find a way to invalidate metadata cache and found two ways:

  • Bundles can register resources using ContainerBuilder::addResource and Kernel checks resource freshness at the start of initialization. Can we add a user-defined resources? (at least FileResource and DirectoryResource)
  • More flexible and complex way is to create a service, which handles dynamic resource adding and invalidates cache pools separately depending on associated resources. For example: CacheClassMetadataFactory will add directory or file resources to this service associated with cache.serialzier pool. That is dev-only service of course and other services can add their resources to invalidate cache pools.

Example
Well, I ve forked #41961 bugdemonstrating repository and added a very naive invalidator service. It's just a concept, don't blame me if I am on a wrong way. There are still some unresolved problems and I know it (especially init and commit events binding).

https://github.com/Foxprodev/PR-40856
Foxprodev/PR-40856@6c21f94

@carsonbot
Copy link

Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?

@carsonbot
Copy link

Could I get a reply or should I close this?

@carsonbot
Copy link

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

@bastnic
Copy link
Contributor
bastnic commented Mar 31, 2023

FYI, fixed in #49679

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0