Skip to content

Commit

Permalink
FileCacheStorage - ignore concurrent save issues on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 12, 2020
1 parent f01b5e1 commit 769669d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Cache/FileCacheStorage.php
Expand Up @@ -82,8 +82,12 @@ public function save(string $key, string $variableKey, $data): void
}

$renameSuccess = @rename($tmpPath, $path);
if ($renameSuccess === false) {
@unlink($tmpPath);
if ($renameSuccess) {
return;
}

@unlink($tmpPath);
if (DIRECTORY_SEPARATOR === '/' || !file_exists($path)) {
throw new \InvalidArgumentException(sprintf('Could not write data to cache file %s.', $path));
}
}
Expand Down

0 comments on commit 769669d

Please sign in to comment.