Skip to content

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