I have a custom block that reads information from the database. As the user will be filling out a form, refreshing the page and viewing the block it cannot be cached. How do I fix this?
I have tried:
$build['#cache']['max-age'] = 0;
And this did not fix it.
I also tried copying the code from the custom block to the top of the form, so it runs as part of the page, here it doesn't cache. Unfortunately this isn't a solution as I need the block on another page also.