AspNetCore.CacheOutput icon indicating copy to clipboard operation
AspNetCore.CacheOutput copied to clipboard

not support AutoInvalidateCacheOutput?

Open li-zheng-hao opened this issue 4 years ago • 6 comments

li-zheng-hao avatar Aug 27 '22 09:08 li-zheng-hao

in Strathweb.CacheOutput, it support three ways to invalidate cache:

  • [AutoInvalidateCacheOutput] - on the controller level (through an attribute)
  • [InvalidateCacheOutput("ActionName")] - on the action level (through an attribute)
  • Manually - inside the action body

this version only support action level invalidation?

li-zheng-hao avatar Aug 27 '22 09:08 li-zheng-hao

It supports cache invalidation via attribute on controller action and also cache could be invalidated manually by injecting IApiCacheOutput. It is up to you to implement other options which are less useful on my opinion.

Iamcerba avatar Aug 28 '22 13:08 Iamcerba

Can I make any put post delete method in the controller automatically invalidate the cache of the get method(Usage of AutoInvalidateCacheOutput)?or i need to add InvalidateCacheOutput attribute in each put/post/delete method manually?

li-zheng-hao avatar Aug 28 '22 14:08 li-zheng-hao

and if there is many get method in controller , i need add many InvalidateCacheOutput(nameof("ActionName")) attribute in each put/post/delete method , this can cause great inconvenience

li-zheng-hao avatar Aug 28 '22 14:08 li-zheng-hao

If there is a solution to the problem I'm asking, can you please give some sample code ?

li-zheng-hao avatar Aug 28 '22 14:08 li-zheng-hao

ok, I solved this problem by setting method name as *

li-zheng-hao avatar Aug 28 '22 15:08 li-zheng-hao