rust-script icon indicating copy to clipboard operation
rust-script copied to clipboard

Cache cleanup

Open Karrq opened this issue 4 years ago • 2 comments
trafficstars

I noticed the rust-script cache exploding very quickly in size... Is there a way to clean it up properly? I just butchered it manually in my files but I'd rather have a command to remove all older versions and only keep the newest.

Also if a script has not been run for a while it would be nice to have it removed completely (with user flag ofc)

Karrq avatar Nov 23 '20 04:11 Karrq

Hello and thanks for reporting!

I noticed the rust-script cache exploding very quickly in size..

Indeed - this was a consequence of bad (nonexistent) reuse of downloaded and built dependencies. After rerunning a script, all dependencies were downloaded and built from scratch, which as you say caused cache size to explode.

Also, there was no sharing of dependencies between different scripts.

The good news is that the just released 0.10.0 version (install with cargo install rust-script) has fixed that - after rerunning an edited script dependencies will be reused instead of downloaded and built again! This should also improve performance dramatically.

Let me know if you encounter any issue with this!

Is there a way to clean it up properly?

The --clear-cache flag wipes all of the cache (both built files and generated projects).

Also if a script has not been run for a while it would be nice to have it removed completely (with user flag ofc)

Currently generated source projects are purged after one week. But built (executables and dependencies) are never purged automatically, leaving this open to track this.

fornwall avatar Dec 16 '20 04:12 fornwall

I am also experiencing a crazy cache size (~80GB from ~8 months of use). Updating to rust-script 0.20.0 and running rust-script --clear-cache cleared everything immediately. Thanks !

Charles-Schleich avatar Mar 09 '22 14:03 Charles-Schleich