Skip to content

Commit

Permalink
IBX-8534: Added cache invalidation for source content when adding rel…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
ViniTou committed Oct 30, 2024
1 parent ac4e57c commit becfb36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/lib/Persistence/Cache/ContentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ public function addRelation(RelationCreateStruct $relation)
self::CONTENT_IDENTIFIER,
[$relation->destinationContentId]
),
$this->cacheIdentifierGenerator->generateTag(
self::CONTENT_IDENTIFIER,
[$relation->sourceContentId]
),
]);

return $this->persistenceHandler->contentHandler()->addRelation($relation);
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Persistence/Cache/ContentHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function providerForUnCachedMethods(): array
['updateContent', [2, 1, new UpdateStruct()], [['content_version', [2, 1], false]], null, ['c-2-v-1']],
//['deleteContent', [2]], own tests for relations complexity
['deleteVersion', [2, 1], [['content_version', [2, 1], false]], null, ['c-2-v-1']],
['addRelation', [new RelationCreateStruct(['destinationContentId' => 2])], [['content', [2], false]], null, ['c-2']],
['addRelation', [new RelationCreateStruct(['destinationContentId' => 2, 'sourceContentId' => 4])], [['content', [2], false], ['content', [4], false]], null, ['c-2', 'c-4']],
['removeRelation', [66, APIRelation::COMMON, 2], [['content', [2], false], ['relation', [66], false]], null, ['c-2', 're-66']],
['loadRelations', [2, 1, 3]],
['loadReverseRelations', [2, 3]],
Expand Down

0 comments on commit becfb36

Please sign in to comment.