Skip to content

Commit

Permalink
More cache can't be bad ~
Browse files Browse the repository at this point in the history
  • Loading branch information
Korbeil committed Dec 7, 2019
1 parent bca4e50 commit 6475843
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/JsonSchemaRuntime/Reference.php
Expand Up @@ -88,16 +88,17 @@ protected function doResolve()
$contents = json_encode($decoded);
}

self::$cache[$fragment] = $contents;
}

$pointer = new Pointer(self::$cache[$fragment]);
$pointer = new Pointer($contents);
if ('' === $this->mergedUri->getFragment()) {
$array = json_decode($contents);
} else {
$array = $pointer->get($this->mergedUri->getFragment());
}

if ('' === $this->mergedUri->getFragment()) {
return json_decode(self::$cache[$fragment]);
self::$cache[$fragment] = $array;
}

return $pointer->get($this->mergedUri->getFragment());
return self::$cache[$fragment];
}

/**
Expand Down

0 comments on commit 6475843

Please sign in to comment.