Ensuring Drupal route lookups by path are cached by domain

Matt Glaman
3 min readJan 5, 2022

In this episode of “Matt does ridiculous things with Drupal,” I found out that the inbound processing of a path and the lookup for its route gets cached. That makes sense, it can be an expensive process to say /foo is actually an alias of /node/1 and should go to the entity view controller. What I did not know is that the route provider in Drupal creates a cache ID based on the path and language code, only.

Here’s where the cache ID for the request’s route collection is generated (link to the full source.)

--

--

Matt Glaman

PHP software engineer, open source contributor, and speaker