Skip to content

portfolio: refactor caching - and add cron to write cache#23

Merged
protitude merged 5 commits into
2.0.xfrom
portfolio-cache
Jun 23, 2026
Merged

portfolio: refactor caching - and add cron to write cache#23
protitude merged 5 commits into
2.0.xfrom
portfolio-cache

Conversation

@protitude

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the Project Portfolio Google Sheet integration by introducing a shared caching service and adding an Ultimate Cron job to warm that cache, so sheet fetches happen off the request-render path while still allowing a cold-miss fallback.

Changes:

  • Add PortfolioData service to centralize fetch + cache write/refresh behavior (including tag invalidation on refresh).
  • Update PortfolioBlock to use the new service and emit cache metadata (tag + max-age) for downstream caches.
  • Add an Ultimate Cron job and callback to refresh the cache on a schedule, plus unit tests for the new service.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Services/PortfolioData.php New service providing shared fetch/cache + refresh/tag invalidation.
src/Plugin/Block/PortfolioBlock.php Switches block to DI + uses oit.portfolio service; adds cache tag/max-age.
src/Services/CronManager.php Adds cron callback to refresh portfolio cache (live env only).
oit.services.yml Registers oit.portfolio service with cache + tag invalidator dependencies.
config/install/ultimate_cron.job.portfolio_refresh.yml Adds scheduled Ultimate Cron job to warm the portfolio cache.
tests/src/Unit/Services/PortfolioDataTest.php Adds unit tests covering cache-hit/miss and refresh behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/src/Unit/Services/PortfolioDataTest.php
Comment thread tests/src/Unit/Services/PortfolioDataTest.php Outdated
Comment thread tests/src/Unit/Services/PortfolioDataTest.php Outdated
Comment thread config/install/ultimate_cron.job.portfolio_refresh.yml
protitude and others added 4 commits June 23, 2026 15:29
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@protitude
protitude merged commit 6a19b98 into 2.0.x Jun 23, 2026
1 check passed
@protitude
protitude deleted the portfolio-cache branch June 23, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants