Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 302694

Add cache wrapper to the UrlGenerator

$
0
0

Problem/Motivation

This is a follow-up for #1888424: Make Drupal's URL generation logic available to HttpKernel, and minimize code repetition/divergence
Part of this is postponed on #2351015: Convert menu CSRF tokens to use #post_render_cache

Now that we have all link generation centralized into one of two methods on the generator, we need to make it faster. The obvious way to do that is to cache requests to generateFromRoute() and generateFromPath(), so that we catch all of the work done by the outbound path processors.

Proposed resolution

For path alias lookups, we did that with a wrapping object. I think it makes sense to do the same here, with an object that has the same interfaces as the generator but simply forwards requests to it and then caches them. The pattern established by the path alias cache should work fine here. (I think it's now using the Destructable interface? If not, we should do that.)

We may also want to consider removing the cache wrapper from path alias lookups once we're done. We probably shouldn't do that in this patch, but a follow up would be to benchmark and see if it's still useful, and if not, get rid of it to avoid the complexity and extra cache storage.

Remaining tasks

Contributor tasks needed
TaskNovice task?Contributor instructionsComplete?
Update the issue summaryInstructions
Add automated testsInstructions
performance profiling

User interface changes

API changes


Viewing all articles
Browse latest Browse all 302694

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>