public function __destruct()
{
if (self::$_numberOfFilesAddedToCache > 0) {
if (self::isApcUsed()) {
if (PHP_SAPI != 'cli') {
apc_store(self::getCacheKey(), self::$_cache, 0);
}
} elseif (is_dir_writeable(dirname(self::getCacheFilePath()))) {
$fileContent = serialize(self::$_cache);
$tmpFile = tempnam(sys_get_temp_dir(), 'aoe_classpathcache');
if (file_put_contents($tmpFile, $fileContent)) {
if (@rename($tmpFile, self::getCacheFilePath())) {
@chmod(self::getCacheFilePath(), 0664);
} else {
@unlink($tmpFile);
}
}
}
}
}