public function isCached($filename, $id = NULL)
 {
     $hash = base64_encode($filename . $id);
     $this->cacheFilename = optCacheFilename($filename, $id);
     if (!isset($this->cacheData[$hash])) {
         // Need to check, hasn't done yet
         $header = @unserialize(file_get_contents($this->cache . $this->cacheFilename . '.def'));
         if (!is_array($header)) {
             $this->cacheBuffer[$hash]['ok'] = false;
             return false;
         }
         $this->cacheDynamic = $header['dynamic'];
         if ($header['timestamp'] < time() - (int) $header['expire']) {
             $this->cacheBuffer[$hash]['ok'] = false;
             return false;
         }
         $this->cacheBuffer[$hash]['ok'] = true;
         return true;
     }
     $this->cacheDynamic = $this->cacheData[$hash]['dynamic'];
     return $this->cacheBuffer[$hash]['ok'];
 }
 public function isCached($filename, $id = NULL)
 {
     $this->cacheHash = base64_encode($filename . $id);
     $this->cacheFilename = optCacheFilename($filename, $id);
     if (!isset($this->cacheBuffer[$this->cacheHash])) {
         $f = @fopen($this->cache . $this->cacheFilename, 'r');
         if (!is_resource($f)) {
             return false;
         }
         $head = fgets($f);
         if ($head[0] == '<') {
             fclose($f);
             $head = str_replace(array('<' . '?php /*', '*/?>'), '', $head);
             $header = @unserialize($head);
             if (!is_array($header)) {
                 return false;
             }
         } else {
             $header = @unserialize($head);
             if (!is_array($header)) {
                 return false;
             }
             $this->cacheBuffer[$this->cacheHash]['h'] = $f;
         }
         if ($header['timestamp'] < time() - (int) $header['expire']) {
             $this->cacheBuffer[$this->cacheHash]['ok'] = false;
             return false;
         }
         $this->cacheBuffer[$this->cacheHash]['ok'] = true;
         return true;
     }
     return $this->cacheBuffer[$this->cacheHash]['ok'];
 }