If you were going to use any technique off that question, I'd go for the find technique in a cron job and alter it to check the size:
@daily find /home/username/.cache/ -atime +7 -size 50M -delete
Obviously have a play around with that. You may wish to exclude certain paths from the query as .cache
contains a lot of things that can be a real pain in the bum to regenerate (like thumbnails for some media players or photo viewers).
Of course the other option is shifting everything to tmpfs
by adding something like the following to your /etc/fstab
:
tmpfs /home/username/.cache/ tmpfs defaults,noatime,mode=1777 0 0
And that will store everything in RAM (after a sudo mount -a
or a reboot). Obviously this means that as soon as you power off, you've lost everything in there. This is probably only suited to a desktop that rarely gets restarted and that has lots of RAM.
The two could be used in combination.
The other option is to move cache off to slower, cheaper media. If you've space for a big magnetic disk in your computer, that's often a quick and easy way (either with a symlink or a bind-mount) to spread things over multiple disks.
Either that or move something else that isn't speed dependant (like documents, music, etc) to the slow disk, giving you more room for cache on the SSD.