Skip to content

Commit

Permalink
Merge pull request #671 from jameshulse/patch-1
Browse files Browse the repository at this point in the history
Backport cache fix to v3
  • Loading branch information
rubenvanassche authored Feb 20, 2024
2 parents 324970e + 38b9759 commit 06ee679
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Support/Caching/CachedDataConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,21 @@ public function __construct()

public function getDataClass(string $class): DataClass
{
return $this->cache?->getDataClass($class) ?? parent::getDataClass($class);
if (array_key_exists($class, $this->dataClasses)) {
return $this->dataClasses[$class];
}

if ($this->cache === null) {
return parent::getDataClass($class);
}

$dataClass = $this->cache->getDataClass($class);

if ($dataClass === null) {
return parent::getDataClass($class);
}

return $this->dataClasses[$class] = $dataClass;
}

public function setCache(DataStructureCache $cache): self
Expand Down

0 comments on commit 06ee679

Please sign in to comment.