filipw / Strathweb.CacheOutput

ASP.NET Web API CacheOutput - library to allow you to cache the output of ApiControllers
Other
882 stars 253 forks source link

Invalidate cache outside request context. #261

Open alkampfergit opened 4 years ago

alkampfergit commented 4 years ago

Hi,

from the samples I can invalidate easily cache in the context of a web request, but how can I invalidate a cache for a specific controller and action outside a context of a web call? (such as when someone invalidate database and my web application gets a notification outside any web call?)

Thanks.

nomorechickennuggets commented 2 years ago

Same question here. An example of a use-case is that I GET User A's notifications via API call. When User B performs an action that affects User A's notifications, I'd like to be able to invalidate User A's GET /notifications from business logic so I can keep my controllers skinny - idea is to abstract/consolidate my cache management logic away into a dedicated service class that doesn't depend on a request context. This can also be useful when running recurring maintenance tasks that operate outside of controllers, but that might impact notifications. cc @filipw