Limit caching for a specific page
In case you know exactly when something changes (it is your own code doing it), you can also use a cache tag.

'tags' =&gt; ['my-tag'] within #cache and then when it changes, you invalidate it with \Drupal\Core\Cache\Cache::invalidateTags(['my-tag']).

The advantage is that your data is cached as long as possible and also immediately updated when it changes.

If you have constant changes, and that tag would actually result in shorter cache times, then setting a max-age might be more efficient, but that's usually not the case.