Skip to content
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

Invalidate cache outside request context. #261

Open
alkampfergit opened this issue Feb 11, 2020 · 1 comment
Open

Invalidate cache outside request context. #261

alkampfergit opened this issue Feb 11, 2020 · 1 comment

Comments

@alkampfergit
Copy link

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
Copy link

nomorechickennuggets commented Feb 21, 2022

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

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

No branches or pull requests

2 participants