mercredi 3 mars 2021

Cache and update regularly complex data

Lets star with background. I have an api endpoint that I have to query every 15 minutes and that returns complex data. Unfortunately this endpoint does not provide information of what exactly changed. So it requires me to compare the data that I have in db and compare everything and than execute update, add or delete. This is pretty boring...

I came to and idea that I can simply remove all data from certain tables and build everything from scratch... But it I have to also return this cached data to my clients. So there might be a situation that the db will be empty during some request from my client because it will be "refreshing/rebulding". And that cant happen because I have to return something

So I cam to and idea to

  1. Lock the certain db tables so that the client will have to wait for the "refreshing the db"

or

  1. CQRS https://martinfowler.com/bliki/CQRS.html

Do you have any suggestions how to solve the problem?

Aucun commentaire:

Enregistrer un commentaire