Uh oh!
There was an error while loading. Please reload this page.
M.E.C.M. Add TryGetValue(ReadOnlySpan<char>) API - #112695
Conversation
ghost
commented
Feb 19, 2025
Note regarding the |
1 similar comment
ghost
commented
Feb 19, 2025
Note regarding the |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- demand GetAlternateLookup works on the target runtimes - rely on documented "out set to default on failure" lookup behavior
mgravell
commented
Feb 19, 2025
@stephentoub made less defensive in 4f60149, per feedback |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| public bool TryGetValue(System.ReadOnlySpan<char> key, out object? value) { throw null; } | ||
| [System.Runtime.CompilerServices.OverloadResolutionPriority(1)] | ||
| public bool TryGetValue<TItem>(System.ReadOnlySpan<char> key, out TItem? value) { throw null; } | ||
| #endif |
There was a problem hiding this comment.
This will get stomped on when anyone runs the ref generator. We prefer to put such TFM-specific methods in a separator file, e.g. https://github.com/dotnet/runtime/blob/d63f63725a6fd71c7b723640a2418d0f7a30e7bc/src/libraries/Microsoft.Extensions.Caching.Abstractions/ref/Microsoft.Extensions.Caching.Abstractions.netcoreapp.cs
| CoherentState coherentState = _coherentState; // Clear() can update the reference in the meantime | ||
| if (coherentState.TryGetValue(key, out CacheEntry? tmp)) | ||
| coherentState.TryGetValue(key, out CacheEntry? entry); // note we rely on documented "default when fails" contract re the out |
There was a problem hiding this comment.
We could formalize the comment with an assert, e.g.
| coherentState.TryGetValue(key,outCacheEntry?entry);// note we rely on documented "default when fails" contract re the out | |
| boolsuccess=coherentState.TryGetValue(key,outCacheEntry?entry); | |
| Debug.Assert(success||entryisnull,"We rely on documented 'default when fails' contract."); |
Uh oh!
There was an error while loading. Please reload this page.
| /// <param name="value">The located value or null.</param> | ||
| /// <returns>True if the key was found.</returns> | ||
| /// <remarks>This method allows values with <see cref="string"/> keys to be queried by content without allocating a new <see cref="string"/> instance.</remarks> | ||
| [OverloadResolutionPriority(1)] |
stephentoub
commented
Feb 20, 2025
This didn't actually run CI |
stephentoub
commented
Feb 20, 2025
It also merged with https://github.com/dotnet/runtime/pull/112695/files#r1963779247 unaddressed |
mgravell
commented
Feb 20, 2025
via email
Well shoot, it was all briefly green. Will fix: sorry. …On Thu, 20 Feb 2025, 16:00 Stephen Toub, ***@***.***> wrote:
It also merged with
https://github.com/dotnet/runtime/pull/112695/files#r1963779247
unaddressed
—
Reply to this email directly, view it on GitHub
<#112695 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEHMEQJOGMXH7NN7MLLBT2QX3Z7AVCNFSM6AAAAABXOPZ4Q6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZRHEZTINBWGY>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
[image: stephentoub]*stephentoub* left a comment (dotnet/runtime#112695)
<#112695 (comment)>
It also merged with
https://github.com/dotnet/runtime/pull/112695/files#r1963779247
unaddressed
—
Reply to this email directly, view it on GitHub
<#112695 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEHMEQJOGMXH7NN7MLLBT2QX3Z7AVCNFSM6AAAAABXOPZ4Q6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZRHEZTINBWGY>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Implement
MemoryCache.TryGetValueAPIs takingReadOnlySpan<char>, as approved in #110504fix#110504