Skip to content

Commit

Permalink
Simplify ChangedFilesDetector
Browse files Browse the repository at this point in the history
  • Loading branch information
clxmstaab authored and staabm committed Jan 9, 2025
1 parent c59c83a commit ca37977
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/Caching/Detector/ChangedFilesDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ public function cacheFile(string $filePath): void
return;
}

$hash = $this->hashFile($filePath);

$this->cache->save($filePathCacheKey, CacheKey::FILE_HASH_KEY, $hash);
$this->cache->save($filePathCacheKey, CacheKey::FILE_HASH_KEY, $filePathCacheKey);
}

public function addCachableFile(string $filePath): void
Expand All @@ -53,8 +51,7 @@ public function hasFileChanged(string $filePath): bool
$cachedValue = $this->cache->load($fileInfoCacheKey, CacheKey::FILE_HASH_KEY);

if ($cachedValue !== null) {
$currentFileHash = $this->hashFile($filePath);
return $currentFileHash !== $cachedValue;
return $fileInfoCacheKey !== $cachedValue;
}

// we don't have a value to compare against. Be defensive and assume its changed
Expand Down Expand Up @@ -98,11 +95,6 @@ private function getFilePathCacheKey(string $filePath): string
return $this->fileHasher->hash($this->resolvePath($filePath));
}

private function hashFile(string $filePath): string
{
return $this->fileHasher->hashFiles([$this->resolvePath($filePath)]);
}

private function storeConfigurationDataHash(string $filePath, string $configurationHash): void
{
$key = CacheKey::CONFIGURATION_HASH_KEY . '_' . $this->getFilePathCacheKey($filePath);
Expand Down

0 comments on commit ca37977

Please sign in to comment.