-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat: Cache compiled routes #52793
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
feat: Cache compiled routes #52793
Conversation
|
Notes:
|
abc0a2e to
99b3377
Compare
I am not sure if it makes sense for generations, as that’s used less often I suppose?
Cache has a prefix using applications versions, so we’re fine on this point. |
|
Ready for reviews. Should not be merged yet so that we can compare with master performances more easily. |
provokateurin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed commit-by-commit so it is a bit messy because some commits should have been squashed to make sense 🙈
ed23cd2 to
fb4fe2d
Compare
ChristophWurst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Didn't test
fb4fe2d to
c847510
Compare
|
Failing CI is related. Current theory:
I will try to use only enabled applications for the cache prefix. |
83d96b3 to
4105837
Compare
3ced68c to
69a04e5
Compare
c72cb36 to
5565eda
Compare
This is not ideal because serializing the routecollection is not easy. It seems Symfony has its own way of doing things by dumping routes to a PHP file, maybe that would be better, but it would mean pulling a new symfony dependency and maybe refactor our Router. Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
…lude Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
This makes sure the cached routes are updated after enabling a previously disabled application Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
5565eda to
89f51a8
Compare
Avoids a corner case issue if one application was disabled and another one enabled with the same version, just to be safe. Signed-off-by: Côme Chilliet <[email protected]>
This avoids cache issues if some apps are only enabled for some groups, by loading the routes from all apps enabled for anyone, not only the current user. If the queried application is disabled for the current user based on groups, the middleware will cancel the query. Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
| if (!$cachedRoutes) { | ||
| parent::loadRoutes(); | ||
| $cachedRoutes = $this->serializeRouteCollection($this->root); | ||
| $this->cache->set($key, $cachedRoutes, 3600); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key does not include any version number, so this probably means its always cached also on updates?
Because then there is no way to flush on update if the routes have changed, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the cache have a global prefix with all apps version numbers, see
Line 605 in acc2311
| $prefixClosure = function () use ($logQuery, $serverVersion): ?string { |
PR for #54155
Summary
Do the same for the generatorpostponed to follow-up if neededChecklist