Sunday, 9 February 2020

Caching multiple API results

Hi,I'm building my first node application and I need some advice on caching Vs multiple API calls.The user will upload a CSV file with up to 1000 rows of data and 10 columns. The values in each of these columns (account codes, project codes) need to be validated against a production MSSQL server that changes quite frequently.An HTML table will be displayed to the user showing the data file they uploaded and on each row it will show any invalid values, if they change a cell value an Ajax call will be triggered to check the new value is valid.Combinations of values are also checked as some projects are only valid with some accounts.Instead of doing 1000 calls to the MSSQL server to check each line of data I was thinking I could do one call on upload that would ask the server for a copy of the 6 tables from the database server and cache them. This would then allow me to do all of the Checks against the cache.Is there a package that would allow me to do this or would I have to write something? Is it possible to set a time limit on the cache so that after 10 minutes a new version of the cache is created to keep the data as close to live as possible?Or is it perfectly fine to make so many calls at one time?I should say that the data is being held in a mongo DB so while I am validating the data against the production MSSQL I'm not saving to there.Thanks

Submitted February 09, 2020 at 06:32PM by aBitOfCloud

No comments:

Post a Comment