forecache, cgi, and the art of Shockwave

Date: Mon, 30 Mar 1998 15:21:50 -0800
From: kday@macromedia.com (Ken Day)
Subject: Re: Problems with CGI script & .dcr loading

>Our Lingo Guru made us a nice delivery system, but now the CGI scripts in
>our database are making the .dcrs load twice. I'll let him tell it - email
>responses to me directly, or to thw list if it seems relevant.
The hangup you are running into is that cgi retrievals are considered transitory. The assumption is that the results of a second cgi query will be different from the results of the first. So, loading the dcr ignores the first retrieval and goes and gets a new copy. If you were doing a database query and expected up-to-the-minute correct answers, you'd like this.

But there's a way around this. See technote 12777, "How to avoid the security dialog when using getNetText and linked media". This was written up as a way to avoid the security dialog, but includes a way around the repeated downloading of linked media. Check out "forcecache" in getNetText in the tech note.

Synopsis: If the query part of a cgi query starts with the token "forcecache", the results of the query will be left in Shockwave's cache. A subsequent access to EXACTLY the same query url will go to the cache. E.g.


   set url = "http://...getasset.cgi?forcecache+"
   preloadnetthing(url)
   ... netDone() = 1, netError() = "OK", netMime()="application/x-director"
   gotonetmovie url
I believe this is documented only in this technote. 6.0.1 Shockwave only.