DEV Community

Discussion on: How is usually consistency maintained between DB and cache?

Collapse
 
kashyaprahul94 profile image
Rahul Kashyap

I think you can do it on the application level if you want. You can start a transaction of MongoDB in a session, and update data inside mongo, in the same context, update the redis cache too. If that's successful, commit the transaction, else rollback.