Skip to content

Harden cache runtime writes#89

Merged
mehul0810 merged 1 commit into
release/1.6.0from
fix/release-1.6.0-cache-runtime-safety
May 21, 2026
Merged

Harden cache runtime writes#89
mehul0810 merged 1 commit into
release/1.6.0from
fix/release-1.6.0-cache-runtime-safety

Conversation

@mehul0810

Copy link
Copy Markdown
Collaborator

Summary

  • Writes page-cache body and metadata files through same-directory temporary files and atomic renames.
  • Writes the cache body before metadata so fresh metadata never points at a missing or partial body file.
  • Restricts page-cache persistence to cacheable HTML responses: HTTP 200, no Location, no Set-Cookie, and HTML content/body checks.
  • Samples high-traffic cache counters (hits, stale_hits, bypasses, lock_waits) so hot cache traffic no longer persists perform_cache_stats on every request.
  • Uses one uninstall option list for single-site and multisite cleanup, including cache/runtime options.

Validation

  • php -l src/Modules/Cache/PageCache.php && php -l src/Modules/Cache/StatsStore.php && php -l uninstall.php
  • git diff --check
  • Studio reflection smoke: atomic body/meta writes created sample.html and sample.meta.json; HTML response accepted; JSON and redirect responses rejected.
  • Studio stats smoke: sample rate 1 persisted a hit; large sample rate skipped repeated hit increments without creating perform_cache_stats.

Notes

  • composer check-cs -- src/Modules/Cache/PageCache.php src/Modules/Cache/StatsStore.php uninstall.php is still blocked by pre-existing whole-file PHPCS violations in these files, mostly the repo's conflicting short-array rules and legacy formatting. I did not mass-format unrelated release code in this PR.

Closes #82.
Closes #83.
Closes #84.
Closes #85.

@github-actions

Copy link
Copy Markdown

Test on Playground
Test this pull request on the Playground

@mehul0810 mehul0810 merged commit 33ad6fe into release/1.6.0 May 21, 2026
1 of 7 checks passed
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.

1 participant