PHP Classes

File: usage.txt

Recommend this page to a friend!
  Classes of Shaun Thomas  >  cache  >  usage.txt  >  Download  
File: usage.txt
Role: ???
Content type: text/plain
Description: How to Use The Classes
Class: cache
Author: By
Last change:
Date: 20 years ago
Size: 950 bytes


Class file image Download

//  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;


  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.

// Print the buffer.

// Finally, cache the output we've calculated.


For more information send a message to info at phpclasses dot org.