I have a custom Drupal 8 block with class with build() and getCacheMaxAge() functions. getCacheMaxAge() is set to 0 but it is still being cached for anonymous users.
If I put debug code in the build() function I can see it being called when I'm logged in but not for anonymous users.
My code is below. We do have Memcached installed. Would that be causing the issue?
The only other caching modules are core.
<?php
class HeaderPhone extends BlockBase {
/**
* {@inheritdoc}
*/
public function build() {
$info = geo_location_blocks_get_region();
$region = $info['region'];
$tid = $info['tid'];
return array(
'#theme' => 'geo_location_header_phone',
'#region' => $region,
'#view' => views_embed_view('locations', 'block_3', $tid),
);
}
/**
* @return int
*/
public function getCacheMaxAge() {
return 0;
}
}?>
'#cache' => ['max-age' => 0]]
.