Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/4.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
ViniTou committed Oct 22, 2024
2 parents d147998 + 2fbf8ca commit cdaaf25
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/lib/Persistence/Cache/ContentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -621,18 +621,18 @@ public function countReverseRelations(int $destinationContentId, ?int $type = nu
$cacheItem = $this->cache->getItem(
$this->cacheIdentifierGenerator->generateKey(
self::CONTENT_REVERSE_RELATIONS_COUNT_IDENTIFIER,
[$destinationContentId],
[$destinationContentId, $type],
true
)
);

if ($cacheItem->isHit()) {
$this->logger->logCacheHit(['content' => $destinationContentId]);
$this->logger->logCacheHit(['content' => $destinationContentId, 'type' => $type]);

return $cacheItem->get();
}

$this->logger->logCacheMiss(['content' => $destinationContentId]);
$this->logger->logCacheMiss(['content' => $destinationContentId, 'type' => $type]);
$reverseRelationsCount = $this->persistenceHandler->contentHandler()->countReverseRelations($destinationContentId, $type);
$cacheItem->set($reverseRelationsCount);
$tags = [
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Resources/settings/storage_engines/cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ parameters:
content_locations: 'cl-%s'
content_relations_count_with_by_version_type_suffix: 'crc-%%s-v-%%s-t-%%s'
content_relations_list_with_by_version_type_suffix: 'crl-%%s-l-%%s-o-%%s-v-%%s-t-%%s'
content_reverse_relations_count: 'crrc-%s'
content_reverse_relations_count: 'crrc-%%s-t-%%s'
content_version_info: 'cvi-%s'
content_version_list: 'c-%s-vl'
content_version: 'c-%%s-v-%%s'
Expand Down
23 changes: 19 additions & 4 deletions tests/lib/Persistence/Cache/ContentHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public function providerForCachedLoadMethodsHit(): array

// string $method, array $arguments, string $key, array? $tagGeneratingArguments, array? $tagGeneratingResults, array? $keyGeneratingArguments, array? $keyGeneratingResults, mixed? $data, bool $multi = false, array $additionalCalls
return [
['countReverseRelations', [2], 'ibx-crrc-2', null, null, [['content_reverse_relations_count', [2], true]], ['ibx-crrc-2'], 10],
['countReverseRelations', [2, null], 'ibx-crrc-2-t-', null, null, [['content_reverse_relations_count', [2, null], true]], ['ibx-crrc-2-t-'], 10],
['countReverseRelations', [2, 8], 'ibx-crrc-2-t-8', null, null, [['content_reverse_relations_count', [2, 8], true]], ['ibx-crrc-2-t-8'], 10],
['countRelations', [2], 'ibx-crc-2-v--t-', null, null, [['content_relations_count_with_by_version_type_suffix', [2, null, null], true]], ['ibx-crc-2-v--t-'], 10],
['countRelations', [2, 2], 'ibx-crc-2-v-2-t-', null, null, [['content_relations_count_with_by_version_type_suffix', [2, 2, null], true]], ['ibx-crc-2-v-2-t-'], 10],
['countRelations', [2, null, 1], 'ibx-crc-2-v--t-1', null, null, [['content_relations_count_with_by_version_type_suffix', [2, null, 1], true]], ['ibx-crc-2-v--t-1'], 10],
Expand Down Expand Up @@ -137,15 +138,29 @@ public function providerForCachedLoadMethodsMiss(): array
[
'countReverseRelations',
[2],
'ibx-crrc-2',
'ibx-crrc-2-t-',
[
['content', [2], false],
],
['c-2'],
[
['content_reverse_relations_count', [2], true],
['content_reverse_relations_count', [2, null], true],
],
['ibx-crrc-2'],
['ibx-crrc-2-t-'],
10,
],
[
'countReverseRelations',
[2, 8],
'ibx-crrc-2-t-8',
[
['content', [2], false],
],
['c-2'],
[
['content_reverse_relations_count', [2, 8], true],
],
['ibx-crrc-2-t-8'],
10,
],
[
Expand Down

0 comments on commit cdaaf25

Please sign in to comment.