Skip to content

Added a router listener #5

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

Merged
merged 7 commits into from
Dec 10, 2015
Merged

Added a router listener #5

merged 7 commits into from
Dec 10, 2015

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Dec 10, 2015

This caches all the result for the router to be used for later.

TODO: We need to improve the cache key.

@Nyholm
Copy link
Member Author

Nyholm commented Dec 10, 2015

This implementation caches the response from the router. It requires 2 1 cache lookups per HTTP request. When we get a cache miss we spend some extra time on the route lookup because we do not cache the route collection anymore.

Any comments?

@Nyholm
Copy link
Member Author

Nyholm commented Dec 10, 2015

Do we need the query params in the cache key?

$request = $event->getRequest();

if (!$request->attributes->has('_controller')) {
// routing has not taken place
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it has controller, i think routing HAS taken place, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed the "!".

If NOT the $request has _controller, no routing has taken place

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Derp, i thought this was in onBeforeRouting for some reason.

@Nyholm
Copy link
Member Author

Nyholm commented Dec 10, 2015

Done!

cryptiklemur added a commit that referenced this pull request Dec 10, 2015
@cryptiklemur cryptiklemur merged commit 7e1edeb into master Dec 10, 2015
@Nyholm Nyholm deleted the routing branch December 10, 2015 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants