views:

47

answers:

1

For a simple rss reader, I am storing the results of queries in a client side (google gears) database.

So, myapp.php?query=xyz is stored in one column, and the result xml is stored in the next column.

Then, when myapp.php?query=xyz is requested, I first attempt to load from the cached content in the second column.

I need to figure out when I should replace/refresh/overide that cached content with content from the server.

I also need to figure out when to update the displayed data.

Should I replace the cache in the background, after displaying the cached content, and then the user sees it next time they navigate to that screen?

Should I show the cached content and then replace the content "before their eyes" when the server returns new data?

What is the appropriate point to 1) replace the cache with new data 2) update the displayed data

Any help would be greatly appreciated!

A: 

Also store the file time stamp (or last time changed stamp) in a 3rd column of the database table. When you detect the origin time is different then grab a new copy. Likewise you could do it with data size or some other kind of detection mechanism that fits your content.

It's unusual to replace info a lot 'before the eyes' on the web, unless there's a need for real-time data. But a web app might not be the best choice for real time data because of its request-response stateless model. You'll certainly use a lot more bandwidth to refresh it continually before their eyes.

It depends on the requirements of the app.

John K