1

I installed a module quizzard and after uninstallation I am getting this error

Uncaught PHP Exception Symfony\Component\Routing\Exception\RouteNotFoundException: "Route "quizard.quizard_config_form" does not exist." at /home/paddu008/public_html/core/lib/Drupal/Core/Routing/RouteProvider.php line 190

So how do I rebuild route cache programmatically.

1

3 Answers 3

4

If you would like to clear route cache programmatically in drupal 8, use the following:

\Drupal::service('router.builder')->rebuild();
1
  • This can be run from the command line as drush eval '\Drupal::service("router.builder")->rebuild();'
    – Beau
    Mar 22, 2019 at 23:41
1

Rebuild cache programmatically execute: drush cr

2
  • no i cant install drush due to space requirements May 23, 2017 at 6:21
  • how we can do this programmatically without drush command?
    – latikas
    Oct 13, 2017 at 8:45
1

On Exact Cases such as hook_preprocess_pager(&$variables) {...

You can also use

$variables['#cache']['max-age'] = 0; \Drupal::service('page_cache_kill_switch')->trigger(); cache_clear_all() // For Drupal-7 drupal_flush_all_caches() // For Drupal-8

You can also use this as guide - https://stackoverflow.com/questions/43608217/how-to-clear-cache-programmatically-in-drupal-8

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.