I am creating a command line utility using go , which will request particular server for data and will get the data from server in JSON response. Utility can do multiple requests for multiple products . I am able to do multiple requests and get the response for each product properly in JSON format. Now , I want to save the result locally in caching or local files. By which on every request I will check the local cache before sending request to server . If data is available for that product then no request will be send .
I want to save the whole json response in cache or local file and keep that data every time before doing any request to server for data.
Use Case : Products {"A","B","C","D","E"} It could be any number of products Test 1 : Get data for A,B,C Check local storage whether data is available or do request. Save json request in storage for each product.
So for test 1 ,It will have entry like: [{test 1 : [{product a : json response} , {product b : json response} ,{product c : json response}]}]
And in case if test fails in between and it get results for two products it should save response for 2 products and if we reran the test it will get result for 3rd product only.