-
Notifications
You must be signed in to change notification settings - Fork 252
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
Excluding action arguments with [FromUri] attribute from cache key #225
base: dev
Are you sure you want to change the base?
Conversation
Hi, your implementation works for this specific scenario, but will break cases such as when using
Related: #227 |
Hi, @JobaDiniz, Could you please clarify why it will not work in your scenario? I went on the path of least resistance and just removed redundant part from cache key, because seems it will always simply call .ToString() method of complex argument (in your scenario it will be something like this (if .ToString() will not be overridden): certificate={namespace].MyCertificate). |
Your implementation ignores reference types:
You're filtering out reference types with |
Yes, they are ignored. Their properties will be extracted from query string later as raw key-value pairs (i.e.: &point=1,2 will be threaded by model binder, but .GetQueryNameValuePairs() will add it to cache key as raw value: ...-...&point=1,2&...:application/json; charset=utf-8). |
That's my point, in the case of
It can come from headers or claims, etc. |
I see now, thank you. But I believe old implementation also doesn't catch such scenario. I assume client certificate is being used for authentication. If yes and if it is not used within controller as argument maybe it will be better to implement your own CacheKeyGenerator to store certificate data as part of cache key? Anyway it will be tricky to handle such scenarios within DefaultCacheKeyGenerator. |
Scenario: One of action arguments is a class attributed with [FromUri].
As a result the following key generated:
Expected result: