I’m using Redis with MySQL in a Node.js webite but my data changes frequently. Is Redis caching a good idea in this case?

I implemented the middleware that expires in 5 minutes, but how will the cache update? I also tried another approach with Pub/Sub using Redis, but when will it update? In the update function, I also tried something like this:

But this will I want to add everywhere when db is inserted, delted,updated then delete the cache key. Any other solution for this?

Redis implementation logic with better solution how to delete a cache when update delete insert in primary DB.