Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

M.E.C.M. Add TryGetValue(ReadOnlySpan<char>) API#112695

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mgravell merged 7 commits intodotnet:mainfrommgravell:marc/MECMSpanGet
Feb 20, 2025

Conversation

@mgravell
Copy link
Contributor

ImplementMemoryCache.TryGetValue APIs takingReadOnlySpan<char>, as approved in#110504

fix#110504

0xfeeddeadbeef, nietras, antoniofreire, and alienwareone reacted with hooray emoji
CopilotAI review requested due to automatic review settingsFebruary 19, 2025 15:32
@ghost
Copy link

Note regarding thenew-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

1 similar comment
@ghost
Copy link

Note regarding thenew-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

- demand GetAlternateLookup works on the target runtimes- rely on documented "out set to default on failure" lookup behavior
@mgravell
Copy link
ContributorAuthor

@stephentoub made less defensive in4f60149, per feedback

publicboolTryGetValue(System.ReadOnlySpan<char>key,outobject?value){thrownull;}
[System.Runtime.CompilerServices.OverloadResolutionPriority(1)]
publicboolTryGetValue<TItem>(System.ReadOnlySpan<char>key,outTItem?value){thrownull;}
#endif
Copy link
Member

Choose a reason for hiding this comment

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


CoherentStatecoherentState=_coherentState;// Clear() can update the reference in the meantime
if(coherentState.TryGetValue(key,outCacheEntry?tmp))
coherentState.TryGetValue(key,outCacheEntry?entry);// note we rely on documented "default when fails" contract re the out
Copy link
Member

Choose a reason for hiding this comment

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

We could formalize the comment with an assert, e.g.

Suggested change
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.");

/// <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)]
Copy link
Member

Choose a reason for hiding this comment

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

@333fred,@jaredpar, just FYI on more use of ORPA.

@mgravellmgravell merged commit7e9343b intodotnet:mainFeb 20, 2025
3 checks passed
@stephentoub
Copy link
Member

This didn't actually run CI

@stephentoub
Copy link
Member

It also merged withhttps://github.com/dotnet/runtime/pull/112695/files#r1963779247 unaddressed

@mgravell
Copy link
ContributorAuthor

mgravell commentedFeb 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 withhttps://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 withhttps://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: ***@***.***>

Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@vcsjonesvcsjonesvcsjones left review comments

Copilot code reviewCopilotCopilot left review comments

@stephentoubstephentoubstephentoub approved these changes

Assignees

@mgravellmgravell

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[API Proposal]: M.E.C.M. MemoryCache - add ReadOnlySpan<char> get API

3 participants

@mgravell@stephentoub@vcsjones

[8]ページ先頭

©2009-2025 Movatter.jp