Please follow the below to resolve this
If you want to run Cache and reindexing automatically this done by cron job,You can set cron job as requirements.
Refresh Cache Using Cron : http://vagento.com/automatically-refresh-cache-using-cron-magento-2/For reindexing you have to set mode of indexing Update On Schedule : https://docs.magento.com/m2/ce/user_guide/system/index-management.htmlFor better understand about cron : https://docs.magento.com/m2/ce/user_guide/system/cron.html
Let me know if any issues
If my answer is useful, please Accept as Solution & give Kudos