Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep WfdMetaResource instances in the regular metadata file #47

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/Config/WfdMetaConfigCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,20 @@ public function isWfdMetaFresh(): bool

public function write($content, array $metadata = null): void
{
/** @var WfdMetaResource[] $wfdMetaResources */
$this->innerCache->write($content, $metadata);

// Create an extra cache layer by collecting all WfdMetaResources, fetching the current
// timestamp for the data they represent and put everything together into an extra
// `.wfd_meta` metadata file.

$wfdMetaResources = [];

foreach ($metadata as $key => $resource) {
if ($resource instanceof WfdMetaResource) {
unset($metadata[$key]);
$wfdMetaResources[(string) $resource] = $resource; // use key to dedup resource
}
}

$this->innerCache->write($content, $metadata);

$timestamp = null;

if ($wfdMetaResources) {
Expand Down
Loading