You can implement the HTTP
class and call the method setNoCacheHeaders
, as you can see below.
use Magento\Framework\App\Response\Http;
public function myCustomMethod(){
$this->response->setNoCacheHeaders();
...
}
It will implement this module below, which will set no-cache in the header.