Is there a way to clear the cache automatically on Symfony?

  php, symfony, symfony4

I’m working on a "legacy" Symfony (it’s using Symfony 4 but It’s not maintained anymore). The problem is that the cache folder is growing every day, raising 50GB after a few months.

It’s running as a DEV environment, but as the original developer left the company we would like to just "patch" the problem cleaning the cache after X time instead of changing the environment to a production one (which could lead to different problems and maybe it won’t solve the cache issue), just like rotating Symfony logs where you can configure Symfony to log every day in a different file and remove old files automatically.

Source: Symfony4 Questions