You must save the timestamp whenever the database or table you want to cache. If there are linked tables or those that change to a similar timeframe, you can group them into families that have the same timestamp.
Whenever you need data, you must first request a timestamp. If it has not changed, use cached data. If it has changed, ask for fresh data, update your cache and request the timestamp of all ancestor data recursively.
The checksum does not work, because they can collide, and you will have to ask for fresh data in any case to check for collisions. The old / changed flag will not work, because you wonβt know when the data was changed, it could be before your previous timestamp. A version identifier that always increases after each change and never decreases will also work.
If you use the RESTful web service, the GET HEAD code will only return you an HTTP header, which may include a timestamp. If your web service does not include timestamps, you will need to identify new ones that will return them.
source share