From 1ad4dd6e3d76752ed75379baca8829fdd7246d62 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:09:25 +0200 Subject: [PATCH] TASK: 5243 remove ContentGraphFinder runtime cache --- .../DoctrineDbalContentGraphProjection.php | 9 +------- .../Classes/ContentGraphFinder.php | 23 +------------------ 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php b/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php index 5f8a3069806..c0886b1b24b 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php @@ -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; @@ -64,7 +63,7 @@ * @implements ProjectionInterface * @internal but the graph projection is api */ -final class DoctrineDbalContentGraphProjection implements ProjectionInterface, WithMarkStaleInterface +final class DoctrineDbalContentGraphProjection implements ProjectionInterface { use NodeVariation; use SubtreeTagging; @@ -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 diff --git a/Neos.ContentRepository.Core/Classes/ContentGraphFinder.php b/Neos.ContentRepository.Core/Classes/ContentGraphFinder.php index 9f9cfb2f2d6..36a7da4fea1 100644 --- a/Neos.ContentRepository.Core/Classes/ContentGraphFinder.php +++ b/Neos.ContentRepository.Core/Classes/ContentGraphFinder.php @@ -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; @@ -31,11 +30,6 @@ */ final class ContentGraphFinder implements ProjectionStateInterface { - /** - * @var array - */ - private array $contentGraphInstances = []; - public function __construct( private readonly ContentGraphFactoryInterface $contentGraphFactory ) { @@ -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); } /**