Disable cache for a custom page from route declaration.
If you want to disable cache for a custom controller (Custom module), You have the no_cache option (YOUR_MODULE.routing.yml).
Example :
File: mymodule.routing.yml
mymodule.myroute:
path: '/mymodule/mypage'
defaults:
_controller: '\Drupal\mymodule\Controller\Pages::mypage'
_title: 'No cache page'
requirements:
_access: 'TRUE'
options:
no_cache: 'TRUE'