electron/get

Expose Functionality to Clear/Delete Versions From Cache

dsanders11 opened this issue ยท 3 comments

Would be useful if this library exposed functions which could be used to:

  • Clear the entire cache
  • Delete specific versions from the cache

Since Electron Fiddle uses this project to download versions, the delete functionality in Fiddle only deletes some of what's downloaded to disk, since the cache here in the get project lives on.

So ideally this project would expose a function that Fiddle could use to delete a cached version from disk so that delete in Fiddle truly means delete, instead of leaving gigs of cached versions behind. For someone with limited disk space (500 GB), this is a noticeable pain point.

I think it would be better if get just allowed fiddle to say "bypassCache: true". Exposing cache related API surface doesn't sound fun as we mess with cache related things all the time. Just saying "plz no cache I'll do it myself" seems more reasonable

@MarshallOfSound, fair point. I was just thinking clear/delete wouldn't get too far into the weeds, but you're right, any new API surface is a new maintenance burden.

Just my 2 cents, but maybe noCache or dontCache or dontCacheArtifact could work as the option name, bypassCache could be confusingly close to force since force "bypasses" the cache and downloads the file again, but still caches the result.

EDIT: And the options could dovetail together then a bit, where dontCacheArtifact: true could still read an existing cached version if it exists (to take advantage of it being cached from some other usage of get), but wouldn't save to the cache, and adding in force: true would let you always re-download and not add it to the cache.

EDIT 2: Or to align with the HTTP cache headers, noStore.

๐ŸŽ‰ This issue has been resolved in version 3.1.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€