private function loadCache()
{
$file = $this->getCacheFile();
$this->classes = @(include $file);
// @ file may not exist
if (is_array($this->classes)) {
return;
}
if (!is_dir($this->tempDirectory)) {
@mkdir($this->tempDirectory);
// @ - directory may already exist
}
$handle = fopen("{$file}.lock", 'c+');
if (!$handle || !flock($handle, LOCK_EX)) {
throw new \RuntimeException("Unable to create or acquire exclusive lock on file '{$file}.lock'.");
}
$this->classes = @(include $file);
// @ file may not exist
if (!is_array($this->classes)) {
$this->classes = [];
$this->refresh();
$this->saveCache();
}
flock($handle, LOCK_UN);
fclose($handle);
@unlink("{$file}.lock");
// @ file may become locked on Windows
}