madskristensen / WebEssentials.AspNetCore.OutputCaching

Other
52 stars 17 forks source link

Add some feature and break limition #18

Closed AliRezaBeigy closed 2 years ago

AliRezaBeigy commented 4 years ago

Support Post method Support Json Body for VaryByParam option Handle Authorized user by append userid to cacheKey Add option for caching the response based on the user Add method to service for remove cache of an action

madskristensen commented 4 years ago

I don't fully understand the purpose of doing output caching on POST requests? Also, it seems like you only added support for JSON request bodies. I don't understand that either. Can you please help explain the reasoning for this?

AliRezaBeigy commented 4 years ago

I don't fully understand the purpose of doing output caching on POST requests? Also, it seems like you only added support for JSON request bodies. I don't understand that either. Can you please help explain the reasoning for this?

My team develop a application that based on web api most of the action are used http post and transfer json data we need to cache response of some actions so we need these changes

also I added support for removing cache of action because we analyze system to find out where the cache must be removed to increase cache duration since knowing the the right time to invalidate the caches gives you the opportunity to increase cache duration without having concerns about its reliability. And about IsUserBased option, in some of the actions the user are authorized and action's response is the same so these are the reason i think we should have these options

madskristensen commented 4 years ago

I understand the authorization option, which makes perfect sense to me. The JSON request body option doesn't seem like something of generic nature and more something specific to your particular use case.

AliRezaBeigy commented 4 years ago

I understand the authorization option, which makes perfect sense to me. The JSON request body option doesn't seem like something of generic nature and more something specific to your particular use case.

As you can see in the following reference the api controller in asp core return json-formated result with ok method: "The built-in helper method Ok returns JSON-formatted data:"

https://docs.microsoft.com/en-us/aspnet/core/web-api/advanced/formatting?view=aspnetcore-3.1