Hi steven,
I wouldn't describe this as the intended behavior, but it's somewhere
in the gray area between broken and intended behavior. If I were to
hypothesize at the cause, your server is probably taking too long to
return a result when the proxy requests it. Rather than failing
outright, the proxy returns the cached result. On the subsequent
request, the same behavior occurs, except you're now viewing the "new"
copy. With each subsequent request, the cached version is being
returned and then the cached version is overridden with the result
from your server.
This suggests to me, though, that if the cache were empty, your first
request would give an error (or no data). If that isn't happening,
then the timeout for a new request must be slightly longer than one
with a cached copy.
In any case, appending a "random" value to your URL will probably
work, but don't make it completely random. A good suggestion is to use
a timestamp modulo some value such as with:
function makeCachedRequest(url, callback, refreshInterval) {
var ts = new Date().getTime();
var sep = "?";
if (refreshInterval && refreshInterval > 0) {
ts = Math.floor(ts / (refreshInterval * 1000));
}
if (url.indexOf("?") > -1) {
sep = "&";
}
url = [ url, sep, "nocache=", ts ].join("");
_IG_FetchContent(url, callback);
}
With refreshInterval set to 1, the file is updated once per second,
globally. I'd suggest making it slightly higher though, unless you
absolutely need the freshest data.
Best,
Dan
On Nov 14, 12:58 pm, steven <[EMAIL PROTECTED]> wrote:
> When using _IG_FetchContent with a refreshInterval of 0, we're
> noticing some strange behavior: if the content at the URL changes, and
> we call _IG_FetchContent, its the old page. If we then call
> _IG_FetchContent again, it is the correct content. This is how we
> have been reproducing it:
>
> 1. _IG_FetchContent with refreshInterval 0
> 2. change the page
> 3. _IG_FetchContent with refreshInterval 0, and we get the old page
> 4. _IG_FetchContent again with refreshInterval 0, and we get the new
> page
>
> Is this the intended behavior? Any tips?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---