caching - Best way to provide `delta` of changes in database record -


we have rest api used mobile application. distilled version, let's assume api provides list of books , contents such author's name, publisher, year , content of pages.

the mobile app needs cache last 10 books in local storage has 10 books available offline. books might updated @ server , app must sync latest changes.

  • a new book added
  • a books updated
  • a book deleted
  • etc

we need way, @ server, provide changes have been made since last time mobile synced. instead of requesting whole latest 10 books request has changed since last fetch.

this has been implemented in version management systems git looking simple way database records.

what very simple way implement such delta?

this simple. need store utc date-time each book created/modified in database, , in app. app needs store last date-time requested update of book information.

then when app requests book list, can provide 'last check' utc date-time api, , api can respond books have changed since time - added, modified, , deleted. need transfer deleted books - flag indicate it's been deleted. transmit count of number of books should in list app can verify it's got correct count.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -