diff --git a/src/CacheInvalidator.php b/src/CacheInvalidator.php index d8a64f9..8ed6a0d 100644 --- a/src/CacheInvalidator.php +++ b/src/CacheInvalidator.php @@ -12,13 +12,13 @@ class CacheInvalidator protected string $filePath, protected bool $updateVersion = false, ) { - if ($this->updateVersion) { + if ($this->updateVersion || ! file_exists($this->filePath)) { $this->version = $this->generateVersion(); file_put_contents($this->filePath, $this->version); } else { - $this->version = file_get_contents($this->filePath); - } + $this->version = file_get_contents($this->filePath); + } } protected function generateVersion() : string @@ -30,4 +30,4 @@ class CacheInvalidator { return $this->version; } -} \ No newline at end of file +}