I am fetching a content of an Internet feed and storing it into a local database (caching). the feed does not have a tag which will tell me when a specific entry in it was created (no date tag). All it has is a title, content, url and image.
Now, I want to make this: if there is no new content on the feed, the app will load from the cache during the specific session. But if I see that there is a new content on the feed, then the app will load from the feed and all later loads (during one session) will go from the cache.
How can I detect in this specific case if there is a new content on the feed or not? Shall I do string comparison of the first X lines of both cache and remote feed? Or there is a better and proper way to do it?
Using your approach you will have to download the entries and compare them to the data stored in your cache. This pretty much renders the cache useless, as one of the things you want to prevent by using a caching mechanism is unnecessary downloads.
Are you sure that there are no header fields that you can use to check for changes? Good candidates are Last-Modified, If-Modified-Since and If-Not-Modified. See Wikipedia's list of header fields for more detailed information on these fields.