Repository navigation
cipi/cache 1.0.0 — purge Cipi's page cache from any PHP app - #1
Merged
Merged
Conversation
PageCache: purge by path, prefix or URL, clear, defer/flush, check, warm, and the headers that let a response be cached (or not). Sudo runner on the server, API runner from anywhere, fake runner for tests. Laravel: facade with purgeRoute(), purges sent when a request/job/command ends, cipi.cache and cipi.nocache middleware, PurgesPageCache model trait, cipi:cache:purge and cipi:cache:check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0199AVTHoNdSA3aXMwVCa8b4
…its cache - The web group's middleware wrap the route's: StartSession and the CSRF middleware added their cookies after cipi.cache had removed them, so a page of a web route was never cacheable. cipi.cache now marks the request, and FinalizeCacheResponse — prepended to the HTTP kernel by the service provider — makes the response public once they are done. The Cookie header as sent decides who is a visitor without cookies. - PurgesPageCache reports a page that is not one instead of throwing from a model event (the row is saved by then). - CI: a Laravel job (Testbench, Laravel 11 and 12) runs tests/Laravel — the middleware in the web group, the model trait. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0199AVTHoNdSA3aXMwVCa8b4
…pendencies) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0199AVTHoNdSA3aXMwVCa8b4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0199AVTHoNdSA3aXMwVCa8b4
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.
First release of
cipi/cache, which purges Cipi's nginx page cache from any PHP app.PageCache:purge()takes a path (every domain of the app, with its?utmvariants), a prefix ending in*, or a URL on one of the app's domains.purgeUnder(),clear(),check(), anddefer()/flush(), which send all of a request's purges in one call.warm()requests pages again so they are cached before visitors arrive.cacheFor()/neverCache()set the headers that let a response be cached, or not.SudoRunnerrunssudo -n /usr/local/bin/cipi-cache-clear <app> <page>…on the server, without a shell.ApiRunnercallsPOST /api/apps/{app}/cache/purge(cipi/api 1.48) from anywhere.FakeRunneris for tests.purgeRoute()andpurgeRouteUnder()purge named routes.cipi.cache[:seconds]andcipi.nocache.PurgesPageCachemodel trait, and the commandscipi:cache:purgeandcipi:cache:check.Tests.
php tests/run.phpruns 39 checks with nothing installed. CI covers PHP 8.1 to 8.4. The Laravel classes are only linted, not run inside a Laravel app.https://claude.ai/code/session_0199AVTHoNdSA3aXMwVCa8b4
Review before release
cipi.cachedid not work inside thewebgroup. The group's middleware wrap the route's:StartSessionand the CSRF middleware added their cookies aftercipi.cachehad removed them, so the page was never cacheable.cipi.cachenow marks the request, andFinalizeCacheResponse— prepended to the HTTP kernel by the service provider — makes the response public once they are done. TheCookieheader as sent decides who has no cookie.PurgesPageCachereports a page that is not one instead of throwing from a model event (the row is saved by then).webgroup, the model trait — green.Generated by Claude Code