Disable caching on a route
You have to do all together, set cache max-age = 0 for all responses the controller returns and apply the kill switch

public function mycontroller() {

  \Drupal::service('page_cache_kill_switch')-&gt;trigger();

  if (!$a) {
    return [
      '#markup' =&gt; 'no',
      '#cache' =&gt; ['max-age' =&gt; 0],
    ];
  }

  return (new TrustedRedirectResponse($url))
    -&gt;addCacheableDependency((new CacheableMetadata())-&gt;setCacheMaxAge(0));
}


and then clear the cache one more time.