From 4ea6db3d3ba8888956370f7e2f246bce86526924 Mon Sep 17 00:00:00 2001 From: QA2A <150867722+QA2A@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:25:06 -0400 Subject: [PATCH] refactor: Clear cache for detail_company_id_user_id in BouncedEmailAPI The cache for the `detail_company_id_user_id` key is now cleared in the `BouncedEmailAPI` view. This change ensures that the cache is updated after processing a bounced email, preventing any stale data from being displayed. It improves the accuracy and reliability of the application. --- website/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/views.py b/website/views.py index f16acbd..4caef0b 100644 --- a/website/views.py +++ b/website/views.py @@ -192,6 +192,9 @@ def post(self, request, *args, **kwargs): company = application.company company.email = "" company.save() + # clear the detail_ cache key + cache_key = f'detail_{company.id}_user_{request.user.id}' + cache.delete(cache_key) return Response( {"detail": "Bounced email processed successfully."},