-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Change keys for import caching #77627
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
Change keys for import caching #77627
Conversation
s_projectItemsCache.AddOrUpdate(project.State, cacheEntry); | ||
#else | ||
s_projectItemsCache.Remove(project.State); | ||
s_projectItemsCache.GetValue(project.State, _ => cacheEntry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the result of this be put into cacheEntry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be fine either way. i prefer this way so that we ensure that we exactly return the data we computed for this exact arguments.
@genlu @jasonmalinowski ptal. |
@ToddGrun ptal. |
namespace Microsoft.VisualStudio.LanguageServices; | ||
|
||
[ExportWorkspaceService(typeof(IWorkspaceCacheService), ServiceLayer.Host), Shared] | ||
internal sealed class WorkspaceCacheService : IWorkspaceCacheService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh, so this thing is not called by anyone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a MetadataId ensures that the cache items for metadata only stay alive as long as the metadata does (and are released once they are). Similary, using a CWT ensures that we only keep things alive as long as something is rooting it. but we release once it is not (obviating the need for custom flushing routines).