Skip to content

Added support for custom cache key provider #10

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

Merged
merged 15 commits into from
May 7, 2022

Conversation

steuic
Copy link
Contributor

@steuic steuic commented Jan 26, 2022

InMemoryCacheHandler now supports custom cache key provider.

Custom cache key provider and already implemented cache key providers
Interface ICacheKeysProvider allow to implement custom cache key providers.
Provider DefaultCacheKeysProvider provides cache key by concatenation of http method (GET or HEAD) and uri.
Provider MethodUriHeadersCacheKeysProvider provides cache key by concatenation of http method (GET or HEAD), specific http headers and uri.

Backward compatibility
When no custom cache key provider is specified, InMemoryCacheHandler will use DefaultCacheKeysProvider which resemble previous cache key composition strategy: concatenation of http method (GET or HEAD) and uri. This allow backward compatibility.

@thomasgalliker
Copy link
Owner

Nice idea. I gonna have a review asap.

@thomasgalliker
Copy link
Owner

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@thomasgalliker
Copy link
Owner

@steuic I added some unit tests. Can you please have a look at the test ShouldGetKey_WithoutMatchingHeader. I think something is going wrong there. The current output key is "MET_GET;HEA_;HEA_;URI_http://unittest/;" which seams to be odd. Do we really have to include headers which are specified to be part of the key even if the request message does not contain them?

Repository owner deleted a comment from azure-pipelines bot Apr 7, 2022
Repository owner deleted a comment from azure-pipelines bot Apr 7, 2022
Repository owner deleted a comment from azure-pipelines bot Apr 7, 2022
Repository owner deleted a comment from azure-pipelines bot May 7, 2022
@thomasgalliker
Copy link
Owner

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@thomasgalliker thomasgalliker merged commit 09a9091 into thomasgalliker:develop May 7, 2022
@thomasgalliker
Copy link
Owner

@steuic you can check the latest pre-release nuget. Your change should be part of it.

@steuic
Copy link
Contributor Author

steuic commented May 7, 2022 via email

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