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

Add TryGetValue #142

Merged
merged 1 commit into from
Mar 15, 2021
Merged

Add TryGetValue #142

merged 1 commit into from
Mar 15, 2021

Conversation

talmroth
Copy link
Contributor

I actually need a Contains but since this version of MemoryCache does not have a Contains TryGetValue is the next best thing.

@talmroth talmroth marked this pull request as ready for review December 11, 2020 02:23
@alastairtree
Copy link
Owner

To do a contains, why not just do Get(key) != null? (Or GerAsync).

@talmroth
Copy link
Contributor Author

talmroth commented Dec 11, 2020

That won’t work with value types and unfortunately I also have a use case where nulls are being cached so I need a definitive way to know if a value is cached.

@alastairtree alastairtree merged commit 33d055c into alastairtree:master Mar 15, 2021
@dseipp
Copy link

dseipp commented Jun 16, 2021

Can this be switched to out T instead of out object if that's what is being returned here?

@alastairtree
Copy link
Owner

Can this be switched to out T instead of out object if that's what is being returned here?

Yes that would be better! Send a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants