Skip to content

Commit

Permalink
Revert fingerprinting/in-memory cache
Browse files Browse the repository at this point in the history
  • Loading branch information
assertchris committed Apr 20, 2024
1 parent 18ee2ed commit e0184dc
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions src/Illuminate/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,36 +213,7 @@ protected function renderContents()
*/
protected function getContents()
{
$hash = hash('xxh3', join(',', $this->fingerprint($data = $this->gatherData())));

if ($cache = static::$cache[($path = $this->path).$hash] ?? null) {
return $cache;
}

static::$cache[$path.$hash] = $this->engine->get($path, $data);

return static::$cache[$path.$hash];
}

/**
* Fingerprint the data so that we can find identical renders.
*/
private function fingerprint(array $data): array
{
return array_map(
function($item) {
if (is_array($item)) {
return serialize($this->fingerprint($item));
}

if (is_object($item)) {
return spl_object_hash($item);
}

return serialize($item);
},
$data,
);
return $this->engine->get($this->path, $this->gatherData());
}

/**
Expand Down

0 comments on commit e0184dc

Please sign in to comment.