CM12 - How to clean the ccmcache

In case you need to clean the ccmcache on the configuration Manager 2012 client, you can manually clean it up from the Control Panel's applet or, use a script to do that (alot of scripts exist in the internet).

But what if you need to automatically clean up the cache i.e. in case it has exceded its default size?
By the way, that can happen, if you haven't upgraded the CM client to the Cumulative Update 2 for System Center 2012 R2 Configuration Manager https://support.microsoft.com/kb/2970177 :

"Client: If the maximum size of the Configuration Manager client cache is exceeded by a software update package, the cache continues to increase beyond its specified limit."

By default, content will always remain in the cache until the content has been used/run. After that, it is available to be removed from the cache, but it not automatically removed unless the cache space is needed.
Of course, the admin can always force a cache deletion from the Configuration Manager Properties.

You may also check the below information from my colleagues:

One of the main concern about client cache is auto-empty mechanism. There are several scripts around the web that deletes client cache but be aware that client will not be notified so will try to use cached content if installation is not succeed yet.
If you configure the package properties with the option to persist content in the client cache, client does not automatically delete package content from cache. https://blogs.technet.com/b/meamcs/archive/2012/10/04/managing_2d00_configuration_2d00_manager_2d00_2012_2d00_client_2d00_cache.aspx