5661l1 Listing 1. The script output is read from the cache file and sent to the client<\#146>s browser. $timeout) return(true); else return(false); } // read cache file and send it to the browser function outputcache() { readfile(cachefilename()); } // cache the script function docache($buffer) { // write the script output into // the cache file $fp=fopen(cachefilename(),"w"); if ($fp) fputs($fp,$buffer); // send the script output to // the browser return($buffer); } if (needscache($CACHE_TIMEOUT)) // the script needs caching ob_start("docache"); else { // the script is cached so let's read // from the cache and exit outputcache(); exit(); } ?>