1 Reply Latest reply: Mar 2, 2009 6:22 AM by Arnout Kazemier RSS

    Turn Cache on and off.

    Phil_W Community Member
      Hi,

      Is it possible to dynamically alter the cache option for a spry dataset?

      I'm rebuilding an old server scripted forum (which heavily consumes bandwidth / is unresponsive at times) using Spry and server side scripts / pages that return the required database data as an XML response etc.

      In 9 times out of 10 cases I want the pages to pull the XML data from the cache as the data on the server database will not have changed.

      I have a loadURL witha callback function to a server side scripted page. The response from the server script tells the callback function whether the XML data needs to be refreshed from the server because the database has new content. The response is only 14 bytes of data so keeps bandwidth down if there is no new data on the server. If there is new data then I am using the loaddata function to refresh the xml data. However it pulls the data from the cache and in this instance I'd like it to pull the data from the server.

      To in simple terms I wish to dynamically alter the cache status of a spry dataset.

      The page I am using for testing this functionality is here http://www.thehmc.co.uk/forum2/latestposts.asp

      Phil
        • 1. Re: Turn Cache on and off.
          Arnout Kazemier Community Member
          Its because of the datacache of the Browsers.

          Your can force them to reload your dataset, by adding a random string to your url.

          Doing a :

          latesttopics.setURL('forum.asp?cache=' + (new Date()).valueOf());
          latesttopics.loadData();

          will force the browser to reload the data from the server.