Skip to content

Commit

Permalink
Optimize FileEngine::gc()
Browse files Browse the repository at this point in the history
SplFileObject constructor throws an exception if the file does not exist or is a directory.
  • Loading branch information
majna committed Aug 20, 2014
1 parent 9049997 commit 380ac9e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/Cake/Cache/Engine/FileEngine.php
Expand Up @@ -271,13 +271,10 @@ protected function _clearDirectory($path, $now, $threshold) {
if (substr($entry, 0, $prefixLength) !== $this->settings['prefix']) {
continue;
}
$filePath = $path . $entry;
if (!file_exists($filePath) || is_dir($filePath)) {
continue;
}

try {
$file = new SplFileObject($path . $entry, 'r');
} catch (RuntimeException $e) {
} catch (Exception $e) {
continue;
}

Expand Down

0 comments on commit 380ac9e

Please sign in to comment.