$value) $parmStr .= '_' . $name . '=' . $value; $parmStr = md5 ($parmStr); $this->lock = NULL; $this->cacheFile = $cacheDir . '/cache_' . $parmStr . '.html'; } function check ($interval=0) { ob_start (); clearstatcache (); if (file_exists ($this->cacheFile) && time () - filemtime ($this->cacheFile) < $interval) { readfile ($this->cacheFile); return TRUE; } else { $this->lock = acquireLock ($this->cacheFile, '1'); // inszwischen koennte der cache von einem anderen aufruf // aktualisiert worden sein, also nochmal checken. clearstatcache (); if (file_exists ($this->cacheFile) && time () - filemtime ($this->cacheFile) < $interval) { releaseLock ($this->lock); readfile ($this->cacheFile); return TRUE; } return FALSE; } } function update () { $page = ob_get_flush (); file_put_contents ($this->cacheFile, $page); releaseLock ($this->lock); } }; ?>