-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
🚀 Feature: Expose Public API to Invalidate Cache #4907
Comments
Hi @Khongchai, appreciate you flagging this. From what I've observed, we invalidate during a PUT request. Could you provide the specific steps you take to replicate the issue, requiring the need for manual invalidation? |
Hi @djabarovgeorge, thank you for the reply. I will try to reproduce this sometime tomorrow if I am able and will get back to you. If I remember correctly, it happened to us in the Edit: as soon as I posted this I came across the cache invalidation method in the promote change usecase for the notification template, but didn't see any for the message template change promotion. We had to invalidate our Redis manually because the handlebars template didn't update, so could this be it? |
@Khongchai Where you able to validate this? |
@Cliftonz Hey, sorry for the long delay. I haven't had time to go over this yet. I'll close this issue for now to unclutter your issues tab. |
🔖 Feature description
Every time I make changes to notification templates, I have to manually invalidate the entity cache in redis in order for the next queries to receive fresh template data. It'd be nice to have a public API that allows us to invalidate specific caches.
For now, I think this is the part that intercepts my get template detail call and return cached data
https://github.com/novuhq/novu/blob/next/apps/worker/src/app/workflow/usecases/send-message/send-message.usecase.ts#L314
🎤 Why is this feature needed ?
My use case is that we want the data to reflect immediately every time we edit a template. Right now, we have to go into redis and delete these manually:
✌️ How do you aim to achieve this?
PUT notification-templates/{template-id} should invalidate the entity cache.
We could, of course, invalidate the keys by interacting with redis API directly, but we don't want to shoot ourselves in the foot later when the implementation details -- the keys -- change.
Edit: I noticed that I said
PUT
endpoint here. That's not the case. I forgot that we were actually promoting the changes not calling the put endpoint directly because we had problems with the production, not development environment.🔄️ Additional Information
I'm referring to the production environment. We are self-hosting. We have no use of the development environment; all of our environments, dev, staging, and prod use different databases.
Found a similar issue, but it was closed already due to inactivity.
#3520
Please let me know if there already is an existing solution or if I have missed something.
Appreciate the work y'all are doing. Thanks!
👀 Have you spent some time to check if this feature request has been raised before?
🏢 Have you read the Code of Conduct?
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered: