Background
I have an iOS app that retrieves data from a server and writes it to a file with NSFileManager, so that the user does not have to retrieve data again from the server every time they want to visit a page. The data that they are retrieving can change from time to time, so I would like to update the data in the app files when it does.
I am using php pages for my backend web services.
Question
What is the technique for checking if the data in my database has changed so that I know that I should update the data in the app? The only way I can think to do this is to create a php page that checks if the data is different from what I have stored, but this kind of defeats the purpose of saving information to files within the app. I want to minimize when the user communicates with the server, because in situations where the user has no service, I would still like there to be valid data that they can see within the app.
Please ask questions if you do not fully understand what I am trying to achieve. Thank you!
If you want to list the most recently added restaurants for example, you could :
If you want to cache computed data, like top 10 user-rated restaurants, you can :
NB : If the computation is expensive on server side, you might want to think about a more clever way to detect data changes.