Skip to content

Conversation

@BentiGorlich
Copy link
Member

@BentiGorlich BentiGorlich commented Aug 11, 2025

  • add caching to the ContentRepository (it still works without the cache being populated) for
    • user follows
    • user magazine subscriptions
    • user domain subscriptions
    • user blocks
    • user magazine blocks
    • user domain blocks
    • user moderated magazines
  • add event subscribers to each event changing one of those collections to clear the cache
  • add caching to the count query of the NativeQueryAdapter (for pagination)
  • hard set the count to 1000 pages if the result set is expected to be large

I separated it from the other PR (#1696) so it is less convoluted to look at :)

@BentiGorlich BentiGorlich self-assigned this Aug 11, 2025
@BentiGorlich BentiGorlich added enhancement New feature or request backend Backend related issues and pull requests labels Aug 11, 2025
@BentiGorlich BentiGorlich force-pushed the new/combined-front-page-caching branch 2 times, most recently from f31bcb7 to 4bfcc37 Compare August 12, 2025 17:12
@BentiGorlich BentiGorlich force-pushed the new/combined-front-page branch 2 times, most recently from efb8031 to c712fc9 Compare August 29, 2025 10:41
@BentiGorlich BentiGorlich force-pushed the new/combined-front-page-caching branch from 4bfcc37 to 3cefd8a Compare August 29, 2025 10:43
@BentiGorlich BentiGorlich force-pushed the new/combined-front-page-caching branch from 3cefd8a to 76bce66 Compare September 7, 2025 13:00
@BentiGorlich BentiGorlich force-pushed the new/combined-front-page branch from c712fc9 to 794797b Compare September 7, 2025 13:00
@BentiGorlich BentiGorlich force-pushed the new/combined-front-page branch from af1ca73 to 1f11333 Compare September 21, 2025 13:28
@BentiGorlich BentiGorlich force-pushed the new/combined-front-page-caching branch from 76bce66 to ab65434 Compare September 21, 2025 13:30
@BentiGorlich BentiGorlich force-pushed the new/combined-front-page branch from 1f11333 to 3da9f39 Compare September 21, 2025 13:33
@BentiGorlich BentiGorlich force-pushed the new/combined-front-page-caching branch from ab65434 to 7ee9a1c Compare September 21, 2025 13:34
melroy89
melroy89 previously approved these changes Sep 21, 2025
Base automatically changed from new/combined-front-page to main September 23, 2025 18:40
@BentiGorlich BentiGorlich dismissed melroy89’s stale review September 23, 2025 18:40

The base branch was changed.

- add caching to the `ContentRepository` (it still works without the cache being populated) for
  - user follows
  - user magazine subscriptions
  - user domain subscriptions
  - user blocks
  - user magazine blocks
  - user domain blocks
  - user moderated magazines
- add event subscribers to each event changing one of those collections to clear the cache
- add caching to the count query of the `NativeQueryAdapter` (for pagination)
- hard set the count to 1000 pages if the result set is expected to be large
@BentiGorlich BentiGorlich force-pushed the new/combined-front-page-caching branch from 7ee9a1c to 6e669d6 Compare September 23, 2025 18:47
@BentiGorlich BentiGorlich enabled auto-merge (squash) September 23, 2025 18:48
@BentiGorlich
Copy link
Member Author

@melroy89 I changed the base branch because this one was based on new/combined-front-page from PR #1696


$numResults = null;
if (!$criteria->magazine && !$criteria->moderated && !$criteria->favourite && Criteria::TIME_ALL === $criteria->time && Criteria::AP_ALL === $criteria->federation && 'all' === $criteria->type) {
if ('test' !== $this->kernel->getEnvironment() && !$criteria->magazine && !$criteria->moderated && !$criteria->favourite && Criteria::TIME_ALL === $criteria->time && Criteria::AP_ALL === $criteria->federation && 'all' === $criteria->type) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally you don't have test code or switches in production code. So the way to do this is most likely stubbing or mocking the interface.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally yes, but this is a performance shortcut which is only relevant in production, as it does not report the actual number of results anymore. How would I be making this an interface that shares the same code but not this performance workaround, without duplicating most of the code?

@BentiGorlich BentiGorlich merged commit ff4978c into main Sep 29, 2025
7 checks passed
@BentiGorlich BentiGorlich deleted the new/combined-front-page-caching branch September 29, 2025 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend related issues and pull requests enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants