I have a Controller using cache tags. I have just been asked a change that requires a
Max-age also (show next event starting from current time); I explained that the only way to have this is with some delay, and we agreed for a max-age of 300.
To test the modification on my development machine, I set a shorter max-age of 60,
return [ '#theme' => 'mytheme', '#my_param' => $value, ... '#cache' => [ 'tags' => $cache_tags, 'max-age' => 60, ], ];
I loaded the page just after a
drush cr, and in the header I got a clear
X-Drupal-Cache: MISS. I loaded it again, and I got a
HIT. Then I waited for a minute... and I got a
Should I be looking for something else? I noticed a
X-Drupal-Dynamic-Cache header also, but it is always set to
EDIT: From the comments I understood that I cannot set a max-age on a page with anonymous access, so the question changes: is there any other workaround, apart from disabling cache on this page, that would have a big impact on performance?