How does `npm cache verify` garbage collection work?

Viewed 280

According to the npm-cache docs: npm cache verify does this:

Verify the contents of the cache folder, garbage collecting any unneeded data, and verifying the integrity of the cache index and all cached data.

How does npm determine what is garbage-collectable or unneeded?

For example, I have a CI job that shares an npm cache with multiple package projects. I want the cache to contain the dependencies for all of them. But I'm worried that if a certain package doesn't hit the cache every so often, the dependency might get garbage-collected. I want to minimize cache thrashing.

0 Answers
Related