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

Improved MemoryCache Usage #20849

Closed
Tornhoof opened this issue Dec 3, 2020 · 0 comments · Fixed by #20850
Closed

Improved MemoryCache Usage #20849

Tornhoof opened this issue Dec 3, 2020 · 0 comments · Fixed by #20850
Assignees
Labels
doc-bug Source - Docs.ms Docs Customer feedback via GitHub Issue

Comments

@Tornhoof
Copy link
Contributor

Tornhoof commented Dec 3, 2020

The first example of using the MemoryCache creates an extra MemoryCacheEntryOptions object,just to set the sliding expiry time. Unfortunately this example is a bit misleading, because it is unclear if MemoryCacheEntryOptions can be reused as it is not marked thread-safe. The bottom line is, that this being the first example, it will lead to developers creating that object just to set extra values even though there are better options available (as you know, everyone just looks for the first copyable code piece ;)). I will create a PR which adds a code sample with Set and absolute expiry without the MemoryCacheEntryOptions in it. Imho it would be better to change the first example, not to use sliding but this would require rather large changes to the narrative of this page or just use the CreateEntry api, but that api is way too clunky to be used in normal circumstances.

This is a direct result of dotnet/runtime#45436


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-bug Source - Docs.ms Docs Customer feedback via GitHub Issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants