When reinstalling a package, chocolatey always deletes download cache #2698
Replies: 4 comments 9 replies
-
This isn't an issue and doesn't use the template, so converting it to a discussion. |
Beta Was this translation helpful? Give feedback.
-
I've found that the cache is never used at all. I'm using
It doesn't actually do anything with it, and just downloads new files each time into that location. |
Beta Was this translation helpful? Give feedback.
-
You're CI / CD system. It was a question rather than a statement.
It will use something that is already in the cache for a specific period of time. I'm not sure what that is off the top of my head but from experience it's not long. Remember, it is a cache, not a repository. If you want it to download from somewhere local, you'll look at setting up a repository. You could simply add a folder on your CI / CD system with internalized packages there. |
Beta Was this translation helpful? Give feedback.
-
"Chocolatey CLI manages the cache. It determines when it has to download a
file again."
And at times it does so by ignoring the existing file, which is silly.
"If you are doing a --force install, the cache isn't used."
Which again is silly. If I install a program then immediately realize that
I wanted to enable some package option, I can force it to reinstall. And at
that point, it erases the cache, downloads the same files to the cache
again, then verifies the integrity of those cached files, and finally
installs them. This is especially silly since by default, it will keep those cached files
forever.
…On Thu, May 19, 2022, 7:30 PM Paul Broadwith ***@***.***> wrote:
Just to reiterate what I said, Chocolatey CLI manages the cache. It
determines when it has to download a file again. The cache isn't a file
store. It's a temporary file store where Chocolatey CLI can store what it
needs to on a temporary basis. The files may be cached in there for a long
time, but it's still a temporary file store.
You *can't* and *shouldn't* rely on *anything* in the cache.
If you need files to be in a known location and Chocolatey to use them
instead of downloading installers / binaries from the internet, then you
need to create a repository to do that.
If you are doing a --force install, the cache isn't used. When you run a choco
uninstall the package you are removing is removed from the cache if it's
still there.
I've raised this issue <chocolatey/docs#475> to
allow us to dig into the code and document it further. In the meantime,
please set up a repository and install from that.
But since it defaults to leave the file in the cache indefinitely, that
behavior doesn't make sense, to me.
Agreed. It does add confusion.
—
Reply to this email directly, view it on GitHub
<#2698 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQN7DTOOJUNPXPGB6L7JD4TVKYJ4VANCNFSM5WHNPVTQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
When one reinstalls a package, chocolatey:
Removes the download cache directory at "C:\Users$user\AppData\Local\Temp\chocolatey$package$version" as part of the uninstall function.
For this, it seems to be calling "remove_cache_for_package(config, packageVersion)" in NugetServices.cs
Then, it redownloads the files that had previously been in the cache
Then, verifies the checksums of the newly downloaded files
This is not optimal as chocolatey could simply reuse the files in the cache directory, verify their checksums, and redownload only when the sums don't match.
Beta Was this translation helpful? Give feedback.
All reactions