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

[Caching] remove one additional interface call and a branch #1603

Merged
merged 1 commit into from
Nov 19, 2020

Conversation

adamsitnik
Copy link
Contributor

This is a very tiny improvement that gives... +1-2k RPS

The Get<T> method is an extension method that uses IMemoryCache interface:

https://github.com/dotnet/runtime/blob/69d61271f900afd7ae6dea7f0c5e57d43090f9dd/src/libraries/Microsoft.Extensions.Caching.Abstractions/src/MemoryCacheExtensions.cs#L18-L21

By using MemoryCache.TryGetValue instead, we remove one interface method invocation and a branch

@adamsitnik
Copy link
Contributor Author

@sebastienros ping

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.

2 participants