Let’s assume that Stackoverflow offers web services where you can retrieve all the questions asked by a specific user. A request to get all question from user A can result in the following json output:
{
{
"question": "What is rest?",
"date_created": "20/02/2010",
"votes": 1,
},
{
"question": "Which database to use for ...",
"date_created": "20/07/2009",
"votes": 5,
},
}
If I want to manipulate and present the data in any ways that I want, will it be wise to dump it in a local database? At some point, I will also want to retrieve all answers for each question and store them in a local database.
The workflow that I’m thinking is:
- User logs in.
- Web services retrieve all questions asked by the logged in user, dump them in a local database.
- User wants all answers for a specific question, another web service does the retrieval and dump them in a local database.
- After user logs out, delete from the local database all questions and answers from that user.
If you implement a smart algorithm your thought can be useful for performance, I think. The point is to determine how much data you should take from service and save to the database. Taking so much data and saving it to db when user logs in, is a bad idea but you can, for example, save half of them in db first and when the other half should be used, you can take and save it.