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

TASK: 5243 remove ContentGraphFinder runtime cache #5246

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\Timestamps;
use Neos\ContentRepository\Core\Projection\ProjectionInterface;
use Neos\ContentRepository\Core\Projection\ProjectionStatus;
use Neos\ContentRepository\Core\Projection\WithMarkStaleInterface;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateClassification;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Node\NodeName;
Expand All @@ -64,7 +63,7 @@
* @implements ProjectionInterface<ContentGraphFinder>
* @internal but the graph projection is api
*/
final class DoctrineDbalContentGraphProjection implements ProjectionInterface, WithMarkStaleInterface
final class DoctrineDbalContentGraphProjection implements ProjectionInterface
{
use NodeVariation;
use SubtreeTagging;
Expand Down Expand Up @@ -133,12 +132,6 @@ public function reset(): void

$this->checkpointStorage->acquireLock();
$this->checkpointStorage->updateAndReleaseLock(SequenceNumber::none());
$this->getState()->forgetInstances();
}

public function markStale(): void
{
$this->getState()->forgetInstances();
}

public function getCheckpointStorage(): DbalCheckpointStorage
Expand Down
23 changes: 1 addition & 22 deletions Neos.ContentRepository.Core/Classes/ContentGraphFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use Neos\ContentRepository\Core\Projection\ContentGraph\ContentGraphInterface;
use Neos\ContentRepository\Core\Projection\ProjectionStateInterface;
use Neos\ContentRepository\Core\SharedModel\Exception\ContentStreamDoesNotExistYet;
use Neos\ContentRepository\Core\SharedModel\Exception\WorkspaceDoesNotExist;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
Expand All @@ -31,11 +30,6 @@
*/
final class ContentGraphFinder implements ProjectionStateInterface
{
/**
* @var array<string, ContentGraphInterface>
*/
private array $contentGraphInstances = [];

public function __construct(
private readonly ContentGraphFactoryInterface $contentGraphFactory
) {
Expand All @@ -50,22 +44,7 @@ public function __construct(
*/
public function getByWorkspaceName(WorkspaceName $workspaceName): ContentGraphInterface
{
if (isset($this->contentGraphInstances[$workspaceName->value])) {
return $this->contentGraphInstances[$workspaceName->value];
}

$this->contentGraphInstances[$workspaceName->value] = $this->contentGraphFactory->buildForWorkspace($workspaceName);
return $this->contentGraphInstances[$workspaceName->value];
}

/**
* To release all held instances, in case a workspace/content stream relation needs to be reset
*
* @internal Should only be needed after write operations (which should take care on their own)
*/
public function forgetInstances(): void
{
$this->contentGraphInstances = [];
return $this->contentGraphFactory->buildForWorkspace($workspaceName);
}

/**
Expand Down
Loading