lifetime = 3600; // Set to consider caches older than 3600 secs (1 hour) expired $cache->name = 'index'; // The cache filename will be based on this value $cache->key = 'key'; // The cache will be saved to a folder whose name is based // on the above value, and the cache filename will be based on // this value // Check to see if an up-to-date cache exists, if so then there is no need to generate // and push information onto the template // Otherwise, push data onto the template if (!$cache->exists()) { // This demos two ways to do the same thing (see demo/index.php) $cache->template->set('variable', 'test variable'); $cache->template->set('true', true); $cache->template['var'] = array('x', 'y', 'z'); $cache->template['false'] = false; } // Inefficient method, see below. Load the cache into the template's output document. $cache->load(); // Finally, output the results header('content-type: text/xml'); echo $cache->template->getXML(true); /* It would be even better if $cache->getFile() is used instead to get the cache's filename for you to parse into a URL redirection. This method would make use of any client-side caching and eliminate the overhead of loading and parsing the cache file. IMPORTANT NOTE: Make sure that you keep caches that may have sensitive information in a non-www accessible location (see documentation on how to have caches stored in several different locations) Pseudo alternate method: $url = yourPathToURLFunction($cache->getFile()); header("Location: $url"); */ ?>