There is no automatic way and I don’t feel there is a need for one.
The idea behind a cache, is to have something locally so you don’t need to redownload it if you need it again.
Do you also want your web browsers to not cache anything? Their cache is likely larger than the package cache when it’s only caching installed packages.
The browser cache is important for browsing. It speeds everything up but a installed package cache is something different. When accessing this forum, I want all images cached so they are shown immediately and the cache is accessed constantly.
The pamac/pacman caches are not accessed that much. How often do you reinstall the same packages over and over again? This is not a “normal” use case.
@followait You could write a pacman-hook that is run in the end that calls pacman -Scc to remove the lines.
To me it’s not about doing it often. It’s about having the option, if you one day boot into the system and your internet does not work. Then you have the option to re-install the driver/kernel or rollback to a working one. I’m just saying. The package cache is handy to have. And disk space is still pretty cheap.
Yes, I understand that, it saved me a lot of time when I tried out pacman v6 when it wasn’t yet supported in Manjaro
My /var/cache/pacman/pkg folder is around 5 GB. If you mount that as tmpfs, your memory (not the cheap disk space) will be decreased a lot. I think the pacman-hook is the best way to go.
Or could maybe trick this setting at put -1 as number of kept packages
ok only for very old ssd - with recent we can write more 30Go by day for 10 years - update is 1go (in cache) by week
or problem is space ?
with pamac we have pamac-cleancache.timer. run systemctl cat pamac-cleancache.{timer,service} for info (first week, each mouth cache is clear) - we can edit it