Repository navigation
Read a build-time class cache on any host, VIP included (1.x, non-breaking) - #43
Merged
Merged
Conversation
Module discovery tokenizes every PHP file in a directory on each request wherever the runtime cache can't be written, which on WordPress VIP is always. This backports the read side of #35 without its breaking change: - `vendor/bin/tenup-framework-generate-class-cache <dir> [<dir> ...]` writes class-loader-cache/class-loader-cache-v2.php (from #35). - get_classes() reads that file when it exists, through #35's ReadOnlyFileDiscoverCacheDriver, on any host. A corrupt file fires `tenup_framework_cache_load_failed` and falls back to discovery. - Without the file, behaviour is exactly 1.3.1's: the runtime cache in production and staging, none on VIP. The command, path, filename and cache ID match feature/2.0.0, so a build step added now keeps working after the upgrade. Co-authored-by: Daryll Doyle <daryll.doyle@10up.com> Co-authored-by: Ryan Leeson <ryan.leeson@get10up.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fabiankaegy
force-pushed
the
feature/read-prebuilt-class-cache
branch
from
November 5, 2026 12:10
141cb71 to
147414e
Compare
darylldoyle
marked this pull request as ready for review
November 5, 2026 12:22
darylldoyle
approved these changes
Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
Module discovery tokenizes every PHP file in a directory on each request wherever the runtime cache can't be written. On WordPress VIP that's every request, because
should_use_cache()returns false there.This backports the read side of #35 to 1.x, without its breaking change:
vendor/bin/tenup-framework-generate-class-cache <dir> [<dir> …]writes<dir>/class-loader-cache/class-loader-cache-v2.php. The command andgenerate_cache()are Make the class-loader cache build-time and add a loader debug page #35's, unchanged.get_classes()reads that file when it exists, on any host, VIP included, through Make the class-loader cache build-time and add a loader debug page #35'sReadOnlyFileDiscoverCacheDriver. It never writes it.tenup_framework_cache_load_failedand falls back to discovery, as in Make the class-loader cache build-time and add a loader debug page #35.TENUP_FRAMEWORK_DISABLE_CLASS_CACHEignores it.should_use_cache()and the runtime cache are exactly as in 1.3.1. That's what keeps this out of 2.0.0: no site changes behaviour until it adds the build step.The command name, cache directory, filename and cache ID match
feature/2.0.0(CACHE_DIR_NAME,CACHE_FILENAME,CACHE_ID). A project that adds the build step for 1.x keeps it unchanged through the 2.0.0 upgrade, and 2.0.0 then removes the runtime writes.Not included from #35: the loader debug page, runtime-cache removal, the #30 fix and the upgrade docs. Those stay in 2.0.0.
Why now
The fueled.com 2026 build runs 19 framework-based plugin and theme directories on VIP. Measured locally against copies of those directories, with
VIP_GO_APP_ENVIRONMENTdefined:Every directory returned the same class list either way. On fdc, plugin loading plus
initis ~0.65 s of a ~1 s uncached request.How to test the Change
composer teston PHP 8.4: 28 tests pass, including the newPrebuiltClassCacheTest. It covers:VIP_GO_APP_ENVIRONMENTdefined;The suite errors on PHP 8.5 before any test runs, inside
antecedent/patchwork, unrelated to this change.composer lintandcomposer staticare clean.phpcs.xmlgets Make the class-loader cache build-time and add a loader debug page #35's exclusion for direct filesystem calls intests/.In a project: run
vendor/bin/tenup-framework-generate-class-cache path/to/src, defineVIP_GO_APP_ENVIRONMENT, and check thatget_classes()returns the cached list without discovering.Changelog Entry
Credits
Props Daryll Doyle and Ryan Leeson: the driver, command and cache format are from #35/#36.
Checklist: