10 messages in com.googlegroups.google-gadgets-api[Google-Gadgets-API] Re: Caching issu...
FromSent OnAttachments
Artyom Ch.27 Jun 2008 07:47 
Jerome (Guru)28 Jun 2008 15:53 
Artyom Ch.28 Jun 2008 19:38 
chandan.a. singe28 Jun 2008 20:12 
นายบุญชัย แสงจันทร์01 Jul 2008 11:11.jpg
นายบุญชัย แสงจันทร์02 Jul 2008 09:07.jpg
jamim10 Jul 2008 13:59 
Justin McConnell10 Jul 2008 16:55 
Jerome (Guru)10 Jul 2008 17:51 
Kevin22 Aug 2008 18:26 
Subject:[Google-Gadgets-API] Re: Caching issues when using _IG_FetchXmlContent
From:Jerome (Guru) (jero@gmail.com)
Date:06/28/2008 03:53:20 PM
List:com.googlegroups.google-gadgets-api

Hi there,

I experienced similar issues with the _IG_Fetch...() function, trying to get a short caching was leading to getting data from a few seconds to minutes old. To avoid this issue, what I do when I must have very recent data in a gadget is: - setting the refresh interval to 0 - appending a random value to the URL being fetched, like for instance http://www.iggamecenter.com/xmldata/games/list0.xml?random=24854398304985 (of course, replace 24854398304985 with a automatically generated random value with Math.rand())

This is putting more stress on the Google proxy and on my backend servers, but this will ensure that the fetchers do their best to get fresh data for the gadget. Of course, if the fetchers get overloaded, you might have time outs or get old data anyway.

I hope this helps.

Jerome

On Jun 27, 9:47 am, "Artyom Ch." <arty@gmail.com> wrote:

I have a gadget that fetches an external XML file every ~15 seconds using _IG_FetchXmlContent function. The third parameter of the function explicitly sets the cache refresh interval to 15 seconds: { refreshInterval: 15 }

It worked well till the last 3 days. During the last three days the gadget has been randomly getting old cached copies of external XML. Sometimes it gets copies, which are 1 hour old. Setting refreshInterval to zero doesn't help. I open the XML file in a browser window and see how it updates every 15 seconds when I manually refresh the page. But the gadget keeps receiving old copies.

I asked other gadget users whether they experience the same problems and got a positive answer.

I created a test gadget for reproducing the problem. The gadget is embedded in the following page:

http://www.iggamecenter.com/work/cachetest.html

The gadget's URL: http://www.iggamecenter.com/work/cachetest6.xml

The gadget fetches the following XML:

http://www.iggamecenter.com/xmldata/games/list0.xml

every 15 seconds and prints a value of "timestamp" attribute of "GameSessionList" tag. The XML file is updated by server every 15 seconds so the "timestamp" attribute should increment by 15 each 15 seconds. You can see it yourself by opening the mentioned XML file in a browser and refreshing it manually.

However, the gadget prints "timestamps", which values are randomly spread over the last hour. I.e. the "{refreshInterval:15}" doesn't work.