Is it possible to alter the cacheability of a specific entity either programatically or via configuration I am writing a custom breadcrumb builder and discovered that the breakpoint I had set in it was not firing due to cache of the breadcrumb entity. When I inspect it after creation, I can see that it is created as permanently cacheable. Ideally, I'd be able to set something in the services.yml file to tell it to ignore that specific entity. Alternatively, if there were a setter that paralleled the getMaxCacheAge() method, that would work.

As it is, it seems like my only good option here to globally switch to the null cache provider.

FWIW, here's my current little snippet of test code:

  public function build(RouteMatchInterface $route_match) {
    $breadcrumb = new \Drupal\Core\Breadcrumb\Breadcrumb();
    $breadcrumb-&gt;addLink(Link::createFromRoute($this-&gt;t('TESTING'), '&lt;front&gt;'));
    return $breadcrumb;
  }
I just came up with a solution, but I'm not sure it's the "right" way to do it. 

Anything entity that implements RefinableCacheableDependencyTrait will allow you to introduce additional dependencies with a call to addCacheableDependency(). I sort of hoped there might be a predefined dependency that was hardcoded to no cache. I didn't find such a thing. What I did find is that if the argument to that method is not an object that implements CacheableDependencyInterface, then it makes it uncacheable. So, here's what I ended up with:

  public function build(RouteMatchInterface $route_match) {
    $breadcrumb = new \Drupal\Core\Breadcrumb\Breadcrumb();
    $breadcrumb-&gt;addLink(Link::createFromRoute($this-&gt;t('TESTING'), '&lt;front&gt;'));
    $breadcrumb-&gt;addCacheableDependency(null);
    return $breadcrumb;
  }