Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How long does stack keep the packages in its cache?

I'm working with the Lean theorem prover and I would like to build features like those of stack and start building library caches. One thing that I'm unsure about is when to delete older packages in the cache. I could think that, if I have two versions of Lean installed, say 3.3.0 and 3.3.1, I could argue for keeping all the versions of all the packages that work on those. Since the Lean syntax moves fast, it is quite restrictive.

On the other hand, I could see keeping only 10 versions of any given package. This could be the 10 most recent versions or the 10 most recently requested versions.

I'd love to know some of the ideas considered in building stack and related tools.

like image 625
simon1505475 Avatar asked Oct 27 '17 17:10

simon1505475


1 Answers

stack keeps packages in cache forever. Or until you manually delete those packages. There's no snapshot garbage collection implemented in stack. So what you can only do is to manually call

rm -rf ~/.stack

to remove whole stack cache. It's in general good practice to do it periodically to remove outdated packages which were accumulated for some period of time. But make sure to backup .stack/global-project/stack.yaml if you changed it manually.

stack command which handles cache removal for you is under development:

https://github.com/commercialhaskell/stack/issues/133

like image 172
Shersh Avatar answered Nov 11 '22 11:11

Shersh