Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make -NoCache skip reading packages from the global packages folder #856

Merged
merged 1 commit into from
Sep 12, 2016

Conversation

joelverhagen
Copy link
Member

Fixes NuGet/Home#1406 and NuGet/Home#3074.

This PR brings -NoCache closer to sanity. Other related caching issues are tracked here:

Check the CachingTests.cs file for assertions on current caching functionality.

To summarize, the caching switches should behave as follows:

-NoCache means "don't read from the cache". If something is in the global packages folder and you are restoring packages.config (that is, the destination folder is something other than a global packages folder), don't use it. Use the version from the source. Same goes for the HTTP cache but the behavior should be consistent between packages.config and project.json.

-DirectDownload means "don't write to the cache". If something is in the global packages folder or HTTP cache, you can use it. The main idea here is to minimize disk usage.

-NoCache and -DirectDownload together should be "isolated mode". You neither read from nor write to the global packages folder (for packages.config) or HTTP cache (for both packages.config and project.json).

/cc @emgarten @yishaigalatzer @MarkOsborneMS @zarenner @zjrunner @pspill

@yishaigalatzer
Copy link
Contributor

yishaigalatzer commented Aug 31, 2016

I would like to review 3132/3389/3390/3392 before executing on any of them. Mostly because we want a new unified cache across multiple feeds for package content (and keep the http cache for metadata only).

This is already on our backlog, and I would love to avoid further investment in the http cache

@joelverhagen
Copy link
Member Author

@yishaigalatzer, the 4 issue numbers you mentioned are not addressed by this PR. My PR addresses 1406 and 3074, both of which are schedule for 3.6. I mentioned these issues to give a high level view of what should be considered for future caching changes.

@yishaigalatzer
Copy link
Contributor

yishaigalatzer commented Aug 31, 2016

Yup and so was my comment

@joelverhagen
Copy link
Member Author

🔔 could I get some eyes on this?

// which means the package in the global packages folder should not be used. In this particular
// case, NoCache needs to imply DirectDownload.
directDownload = true;
packageFromGlobalPackages.Dispose();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it gets the latest content from server with NoCache argument, should it also update it in cache? My assumption is since user didn't specify the directDownload flag so it should write the latest content in cache.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't overwrite packages in the global packages folder. Another process might be using it, something non-NuGet like MSBuild, so our global locking mechanism would not work.

@joelverhagen
Copy link
Member Author

👀 plz?

@jainaashish
Copy link
Contributor

LGTM :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NoCache option does not work for packages.config based restore/install (GlobalPackagesFolder)
4 participants