Is it a good idea to cache data from web services into a database?
Posted
by Thierry Lam
on Stack Overflow
See other posts from Stack Overflow
or by Thierry Lam
Published on 2010-03-08T21:04:35Z
Indexed on
2010/03/08
21:06 UTC
Read the original article
Hit count: 360
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.
© Stack Overflow or respective owner