| <?PHP
//  Here is an example on how to use the buffer/cache class
//  combination I've created.
// Create an output buffer
$BUFF = new CBuffer;
// Create a cache object.
$tmpDir = "/tmp/cache/";
if (!is_dir($tmpDir))
  mkdir($tmpDir, 0755);
$CACHE = new CCache($tmpDir);
// Cache should expire in an hour.
$CACHE->expire = 3600;
// If the file is cached, just print it.  Otherwise, go on with the
// rest of the program.
if ($cached = $CACHE->retrieve())
{
  print $cached;
  exit();
}
/*
  This is where your page will operate.  Notice that
  you can easily use the cache in a header/footer
  combination, perhaps through auto_prepend_file/
  auto_append_file or maybe a couple of functions.
*/
// Get the latest contents of the output buffer.
$BUFF->freshen();
// Print the buffer.
$BUFF->stop();
$BUFF->dump();
// Finally, cache the output we've calculated.
$CACHE->save($BUFF->buff);
?>
 |