$cache_time = 7200; // Time in seconds to keep a page cached
$cache_folder = '/var/www/vhosts/xchoppers.com/httpdocs/cache/custom/categories/'; // Folder to store cached files (no trailing slash)
$cache_filename = $cache_folder.md5($cPath); // $_SERVER['REQUEST_URI']); // Location to lookup or store cached file
//Check to see if this file has already been cached
// If it has get and store the file creation time
$cache_created = (file_exists($cache_filename)) ? filemtime($cache_filename) : 0;
//$cache_created = 0;
if ($cache_created != 0 && (time() - $cache_created) < $cache_time) {
readfile($cache_filename); // The cached copy is still valid, read it into the output buffer
ob_flush();
// flush();
} else {
if(!tep_session_is_registered('customer_id')) {
ob_start(); // Turns on output buffering
}
?>