- Making sure cache file exist before invalidating; creating it if it ain't

This commit is contained in:
Dave M. 2024-02-01 14:53:47 +00:00
parent e2915c356a
commit ed63c1ffe5
1 changed files with 4 additions and 4 deletions

View File

@ -12,13 +12,13 @@ class CacheInvalidator
protected string $filePath, protected string $filePath,
protected bool $updateVersion = false, protected bool $updateVersion = false,
) { ) {
if ($this->updateVersion) { if ($this->updateVersion || ! file_exists($this->filePath)) {
$this->version = $this->generateVersion(); $this->version = $this->generateVersion();
file_put_contents($this->filePath, $this->version); file_put_contents($this->filePath, $this->version);
} }
else { else {
$this->version = file_get_contents($this->filePath); $this->version = file_get_contents($this->filePath);
} }
} }
protected function generateVersion() : string protected function generateVersion() : string