Cache built block configs across requests (self-invalidating) - #72
Cache built block configs across requests (self-invalidating)#72helmutkaufmann wants to merge 3 commits into
Conversation
BlockManager::getConfigs() now stores built configs in the Laravel cache, keyed by an md5 signature of every registered .block file's mtime, plus a per-request in-memory memo. The cache self-invalidates when any block file is added, removed, or edited.
blocksSignature() only globbed the top level of the theme's blocks directory, so editing or adding a .block file in a theme subfolder didn't change the signature and the cache kept serving stale data — even though getBlocks() (Block::listInTheme()) does scan theme block subfolders recursively. Switched to File::allFiles() so the signature covers everything getBlocks() actually picks up.
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Split out of #68 (closed in favor of smaller, focused PRs).
Summary
BlockManager::getConfigs()now stores built configs in Laravel's cache, keyed by a signature derived from every registered.blockfile's mtime (plugin-registered blocks and theme-provided blocks, scanned recursively so nested theme block subfolders are covered too)..blockfile is added, removed, or edited — no manualphp artisan cache:clearneeded.See the README "Performance" section for details.
Test plan
tests/classes/BlockManagerTest.phpcovering in-request memoization, cross-request cache hits, and cache invalidation on both a plugin-block mtime change and a nested theme-block mtime changephp artisan winter:test -p Winter.Blocks)