Skip to content

Commit 0bc7986

Browse files
artygrandnikic
authored andcommitted
Check if disabled cache before save file
1 parent 7b15535 commit 0bc7986

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: src/functions.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ function cachedDispatcher(callable $routeDefinitionCallback, array $options = []
6060

6161
/** @var RouteCollector $routeCollector */
6262
$dispatchData = $routeCollector->getData();
63-
file_put_contents(
64-
$options['cacheFile'],
65-
'<?php return ' . var_export($dispatchData, true) . ';'
66-
);
63+
if (!$options['cacheDisabled']) {
64+
file_put_contents(
65+
$options['cacheFile'],
66+
'<?php return ' . var_export($dispatchData, true) . ';'
67+
);
68+
}
6769

6870
return new $options['dispatcher']($dispatchData);
6971
}

0 commit comments

Comments
 (0)