You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 ifMemoryCacheEntryOptions
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 theMemoryCacheEntryOptions
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 theCreateEntry
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.
The text was updated successfully, but these errors were encountered: