Having worked with Drupal 7 since its launch, I'm learning Drupal 8. At the moment I'm finding that whenever I change anything I have to do drush cache-rebuild to get things working again.

On my VPS this takes 15 seconds (and then the next page load also is slow). I have a feeling this may be a sledge hammer to crack a nut situation.

Is there a more efficient way to get Drupal to recompile the (changed) routes from {module}.routing.yml files?

3 Answers 3


You can use

drush ev '\Drupal::service("router.builder")->rebuild();'

to rebuild the routing information without clearing all the caches.

  • Handy. Only takes 3.5s, a big improvement, many thanks. Shame there's not a drush command for this. Commented Jun 17, 2015 at 8:28
  • Pretty sure that a PR to add a drush cc something would be a accepted, it's a common use case. Or maybe as part of "drush cc menu", which already exists but likely doesn't do much in D8.
    – Berdir
    Commented Jun 17, 2015 at 9:49
  • @Berdir This looks relevant? but it doesn't do the same as this answer says: github.com/drush-ops/drush/commit/… Commented Jun 17, 2015 at 10:15
  • Related, but that just invalidates the menu links, so it's about links.menu.yml. Seems like it should also cover the routes, local tasks and local actions.
    – Berdir
    Commented Jun 17, 2015 at 18:28
  • Good idea berdir! Commented Jun 18, 2015 at 5:48

An alternative to drush is drupal console, which you can then use as:

drupal router:rebuild

Which is a little less typing than the drush ev answer (and a tinsy bit faster, too).

To install drupal console

curl -LSs http://drupalconsole.com/installer | php
mv console.phar /path/to/a/suitable/bin/drupal
drush cc router    

when using drush 9 do the trick now :-)

  • Thanks @andsigno82 it's working well for me
    – sekharctc
    Commented Dec 1, 2021 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.