src/Cache.php
public function start()
    {
        if (!isset($this->_dir)) {
            return false;
        }

        $this->_page = $this->url; // Requested page
        $this->_file = $this->_dir . md5($this->_page) . '.' . $this->_ext; // Cache file to either load or create
        
        $ignore_page = false;

        for ($i = 0; $i < count($this->_ignoreList); $i++) {
            $ignore_page = (strpos($this->_page, $this->_ignoreList[$i]) !== false) ? true : $ignore_page;
        }

        $cachefile_created = (file_exists($this->_file) && ($ignore_page === false)) ? filemtime($this->_file) : 0;
        clearstatcache();

        // Show file from cache if still valid
        if (time() - $this->_time < $cachefile_created) {
            ob_start('ob_gzhandler');
            readfile($this->_file);
            //$time_end = microtime(true);
            //$time = $time_end - $time_start;
            //echo '<!-- generated in ' . $time . ' cached page - '.date('l jS \of F Y h:i:s A', filemtime($cachefile)).', Page : '.$page.' -->';
            ob_end_flush();
            exit();
        }

        // If we're still here, we need to generate a cache file
        //Turn on output buffering with gzip compression.
        ob_start('ob_gzhandler');
    }
public function start()
    {
        if (!isset($this->_dir)) {
            return false;
        }

        $this->_page = $this->url; // Requested page
        $this->_file = $this->_dir . md5($this->_page) . '.' . $this->_ext; // Cache file to either load or create
        
        $ignore_page = false;

        for ($i = 0; $i < count($this->_ignoreList); $i++) {
            $ignore_page = (strpos($this->_page, $this->_ignoreList[$i]) !== false) ? true : $ignore_page;
        }

        $cachefile_created = (file_exists($this->_file) && ($ignore_page === false)) ? filemtime($this->_file) : 0;
        clearstatcache();

        // Show file from cache if still valid
        if (time() - $this->_time < $cachefile_created) {
            ob_start('ob_gzhandler');
            readfile($this->_file);
            //$time_end = microtime(true);
            //$time = $time_end - $time_start;
            //echo '<!-- generated in ' . $time . ' cached page - '.date('l jS \of F Y h:i:s A', filemtime($cachefile)).', Page : '.$page.' -->';
            ob_end_flush();
            exit();
        }

        // If we're still here, we need to generate a cache file
        //Turn on output buffering with gzip compression.
        ob_start('ob_gzhandler');
    }
Start caching BEFORE script