1 year ago

#323919

test-img

summerg

Drupal 9 - custom module caching issue

Longtime D7 user, first time with D9. I am writing my first custom module and having a devil of a time. My routing calls a controller that simple does this:

\Drupal::service('page_cache_kill_switch')->trigger();
die("hello A -  ". rand());

I can refresh the page over and over and get a new random number each

time. But, when I change the code to:

\Drupal::service('page_cache_kill_switch')->trigger();
die("hello B -  ". rand());

I still get "hello A 34234234" for several minutes. Clearing the cache doesn't help, all I can do is wait, it's normally about two minutes. I am at my wits end.

I thought it maybe an issue with my docker instance. So I generated a simple HTML file but if I edit then reload that file changes are reflected immediately.

In my settings.local.php I have disabled the render cache, caching for migrations, Internal Page Cache, and Dynamic Page Cache.

In my mymod.routing.yml I have:

  options:
    _admin_route: TRUE
    no_cache: TRUE

Any hint on what I am missing would be deeply appreciated.

thanks, summer

caching

drupal

drupal-8

0 Answers

Your Answer

Accepted video resources