This are the ways you can delete media and disk cache in after effects.

this is first step:

go to Edit -> Purge -> All Memory & Disk Cache… and see how many GB you have used.
My number is set to 100 GB so I check every time to see when it reaches near 100 GB then I click OK to Clear Disk Cache.
You have a different GB number and you can check it here. Edit -> Preferences -> Media & Disk Cache… and there you can see how many GB yours is.

Mine is set to 100 GB so I will go to Edit -> Purge -> All Memory & Disk Cache… and check how many GB I have used. Earlier mine said 4.1 GB. Normally, I will wait until I have used around 90-100 GB then I will click OK to Clear Disk Cache through Edit -> Purge -> All Memory & Disk Cache…

second step:

right click on Windows sign at left corner of screen -> Run -> type appdata -> Ok -> Roaming -> Adobe -> and find the Common folder.
-> rename the common folder to something else like I renamed it to CommonMonkey you can rename it to whatever you want because when you start the After effects it will recreate the Common folder again.

The Common folder is where it saves the caches and its good to get in a habit to do this maybe every two weeks.

once After Effects starts and the new Common folder is created you can go ahead and delete the Common Folder that you renamed and this will delete all the caches it has previously done. All the new caches will be saved in Common folder again.

alternatively, for step 2.
you can go to Edit -> Preferences -> Media & Disk Cache… and Clear Database & Cache. But, this won’t delete every unnecessary file through the folders. It’s better to do step 2 as we did through the folders by renaming the common folder.

Hope this steps help you to delete caches in after effects.