Skip to content

Commit 70dc363

Browse files
authored
Skip caching for manifest files loaded locally (#1480)
1 parent 75f6492 commit 70dc363

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/CodeGenerator/src/Command/GenerateCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,10 @@ private function loadFile(string $path, string $cacheKey, array $patch = []): ar
470470
{
471471
$path = strtr($path, $this->loadManifest()['variables'] ?? []);
472472

473-
$data = $this->cache->get(__CLASS__ . ':' . $cacheKey);
473+
// For files loaded from a URL, we want to cache them until the URL changes.
474+
$needsCaching = false !== strpos($path, '://');
475+
476+
$data = $needsCaching ? $this->cache->get(__CLASS__ . ':' . $cacheKey) : null;
474477
if (null === $data || $path !== ($data['path'] ?? null)) {
475478
if (empty($patch)) {
476479
$content = json_decode(file_get_contents($path), true);
@@ -487,7 +490,10 @@ private function loadFile(string $path, string $cacheKey, array $patch = []): ar
487490
'path' => $path,
488491
'content' => $content,
489492
];
490-
$this->cache->set(__CLASS__ . ':' . $cacheKey, $data);
493+
494+
if ($needsCaching) {
495+
$this->cache->set(__CLASS__ . ':' . $cacheKey, $data);
496+
}
491497
}
492498

493499
return $data['content'];

0 commit comments

Comments
 (0)