Fresh Calls from CGI's

Date: Thu, 5 Feb 1998 08:59:31 -0700
From: alan <levine@maricopa.edu> 
Subject: Re: getNetText(CGI) - disable cache in ShockWave?
Detlef wrote:
| I'm having a little problem with the caching of files by some browsers.
| Whenever I download anything via shockwave - the movie will use the cache
| of the browser I'm using. Also the movie refelcts the user settings of how
| to handle the browser cache. This is nothing new I know....
| I allways had in mind that calling a CGI is something different and that
| there is no caching of the CGI return value - but there is actualy no
| difference with CGIs...
| When a CGI returns something else but "OK" we are in heavy trouble now. For
| example I try to set up a highscore system and get the actual scores from a
| PERL CGI on my server.
It's been a while since I checked these techniques on all 31 flavors of browsers...

(1) If the CGI script generates a web page (returning an HTML string), include a tag in the being sure to write an old date or at least the current date:


  <META HTTP-EQUIV="EXPIRES" CONTENT="Thu Sep  4 17:49:48 MST 1996">
(2) But more likely in your example, you are returning a plain text string to Director. I have been able to force a fresh server retrieve by appending a variable in the CGI string that has a randomly generated value (i.e. use the ticks). This way, the CGU URL is always unique, i.e from director:

on exitFrame
  global gCGIPath
  -- the URL to the server

  -- build the CGI string; you may have to do some encoding
  -- and string construction if you are using more variables.

  --  randy    : a variable never used in the CGI, just
  --             included to force a fresh server call

  set cgiString = "?score=23&game=blasterrama&randy=" & the ticks
  getNetText( gCGIPath & cgiString)
end
Cary suggested:
| Just add a "?" at the end of your getNetText query string. This forces the
| net call to hit the server and not the cache.
Problem 1: This may only get you ONE fresh cache hit.

Problem 2: If you are sending variables to the CGI, you already have the "?"