Iteration
Iteration

Reputation: 693

How to remove cache automatically from a custom module

I'm building a custom module like described here (https://www.drupal.org/docs/creating-custom-modules) for drupal 8. That's mostly dynamic content that changes with some WebServices calls. My problem is that the internal drupal 8 cache is automatically caching everything, including token and javascripts.

So question is : - can I define somewhere in the module, don't cache it?

Thanks

Upvotes: 1

Views: 591

Answers (1)

baikho
baikho

Reputation: 5368

Not sure if you're dealing with render array caching, but if so you could try:

$build['#cache']['max-age'] = 0;

You can read more about it in Cacheability of render arrays.

Upvotes: 1

Related Questions