Conversation
Co-authored-by: eminos <1682784+eminos@users.noreply.github.com>
config/cloudflare-cache.php
Outdated
| 'nav_tree_saved' => true, | ||
| 'global_set_saved' => true, | ||
| 'global_set_deleted' => true, | ||
| 'url_invalidated' => true, |
There was a problem hiding this comment.
Can we add an inline comment to these to say they are Statamic Static Cache related
There was a problem hiding this comment.
Added inline comments in config/cloudflare-cache.php for purge_on.url_invalidated and purge_on.static_cache_cleared to clearly mark them as Statamic Static Cache related. Addressed in commit 5d80754.
| 'static_cache_cleared' => true, | ||
| ], | ||
|
|
||
| 'use_statamic_static_cache_invalidation' => env('CLOUDFLARE_CACHE_USE_STATAMIC_STATIC_CACHE_INVALIDATION', false), |
There was a problem hiding this comment.
does enabling this disable our own event handling? In that case it should be made clear with a comment of how it works.
There was a problem hiding this comment.
Yes — enabling use_statamic_static_cache_invalidation switches to Statamic Static Cache events only. I added explicit inline config comments and README wording to make the either/or behavior clear. Addressed in commit 5d80754.
There was a problem hiding this comment.
Needs to be clear of how it works. Our own event handling + the new Statamic Static Cache events. We're not using both simultaneously?
There was a problem hiding this comment.
Correct, it is either/or. I clarified this in both config comments and README under an "Event handling modes (either/or)" section. Addressed in commit 5d80754.
There was a problem hiding this comment.
Can we add the debug logging to show if and why something is mis-configured.
There was a problem hiding this comment.
Added debug logs for skipped events and mode mismatches (including disabled addon, mode mismatch, missing mapping, and disabled purge_on keys) to help diagnose misconfiguration. Addressed in commit 5d80754.
There was a problem hiding this comment.
Make sure we have test covering any mis-configurations as well.
There was a problem hiding this comment.
Added focused listener tests for misconfiguration paths, including logging when events are skipped due to mode mismatch. Addressed in commit 5d80754.
There was a problem hiding this comment.
We should log if there is any mis-configuration.
There was a problem hiding this comment.
Implemented debug logging for misconfiguration-related skips in the listener so misconfiguration is visible when cloudflare-cache.debug is enabled. Addressed in commit 5d80754.
There was a problem hiding this comment.
Update the readme to explain how our own event tracking work in conjunction with the Statamic Static Cache events. It's either or, right? Let's make that clear. Add the same comments as in the config file.
There was a problem hiding this comment.
Updated README to match config comments and clearly explain that event handling is either addon legacy events or Statamic Static Cache events (not both simultaneously). Addressed in commit 5d80754.
Co-authored-by: eminos <1682784+eminos@users.noreply.github.com>
The addon currently purges Cloudflare on direct content events, which can be overly broad for sites already using Statamic static cache invalidation rules. This change adds an opt-in mode to consume Statamic invalidation events so Cloudflare purges can follow
static_caching.invalidationbehavior.New opt-in invalidation mode
cloudflare-cache.use_statamic_static_cache_invalidation(env:CLOUDFLARE_CACHE_USE_STATAMIC_STATIC_CACHE_INVALIDATION, defaultfalse).Event wiring for Statamic invalidation flow
Statamic\Events\UrlInvalidatedStatamic\Events\StaticCacheClearedpurge_ontoggles:url_invalidatedstatic_cache_clearedListener behavior changes
UrlInvalidatednow maps to URL-based Cloudflare purge.StaticCacheClearedfollows existing fallback semantics (purge everything when configured).Docs and examples
purge_onkeys.Debug logging for misconfiguration/mode mismatch
cloudflare-cache.debugis enabled) for skipped events and why they were skipped, including:purge_onkeyFocused test coverage
UrlInvalidatedStaticCacheCleared(fallback enabled)StaticCacheCleared(fallback disabled)Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.