View Full Version : Cache Update After Page Load

10-29-2006, 05:36 PM
1) Script Title:
Advanced RSS Ticker (Ajax invocation)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/rsstickerajax/index.htm

3) Describe problem:
Why is a page reload required to update the RSS feed cache?

It could not be easier to install this script, just unzip and it works. Thank you :)

This is the first time I've ever looked into the detail of a AJAX script and I'm confused by how the cache is managed. I expected that the news ticker would get new news without the user having to reload the page. However, from what I can tell the only time the RSS cache file is updated, or read, is when the page with the java script is loaded. After the initial page load it seems that the java script endlessly cycles through the content loaded when the page was requested. So, if a user loaded the page on Friday, left his browser open over the weekend, on Monday the page would be cycling though the same items even if there was new news over the weekend.

If my understanding is correct how would one modify the java script to periodically check the cache to see if it needs to be updated and potentially get new content?

If my understanding is not correct then when when I set cache time to 0 does the cache file time stamp never change.

Than you,

10-30-2006, 01:38 AM
You're right, the way the caching currently works in this script (and any other RSS/Ajax related scripts on DD) is static in that it's not just time dependant (ie: every 30 minutes), but also requires a user action that is revisiting the page in order for the feature to kick in. I'm pretty sure most DHTML scripts work off of this model when it comes to caching content. This is unlike, say, a Java stock ticker that often use the "push" model where new information is automatically pushed to the browser periodically. The reason for the "static/pull" model is simply that in most cases, it's a good enough model to serving RSS feeds while respecting server resources.

At a glance it looks possible to modify the script to periodically check the RSS feed automatically and update itself accordingly, but honestly, it's not a feature on my list of to-dos when I get to updating this script (hopefully soon). For most people it'd be an unnecessary and confusing feature.