Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalidate entries instead of a collection #1

Merged

Conversation

ryanmitchell
Copy link
Contributor

馃憢 Thanks again for this add-on, its really useful.

This PR updates the approach to invalidate Entries themselves rather than the Collection, which still results in the collection rules being triggered:(https://github.com/statamic/cms/blob/801e954a054c0731e9890bb44be92970503cb6f9/src/StaticCaching/DefaultInvalidator.php#L62-L73)

The benefit of this is that you dont need to rely on rules for the invalidation - individual entry urls are invalidated regardless of whether they are in the rules.

If you're happy with this change, I'll raise a separate draft PR to support adding a query scope to the query (which relies on statamic/cms#5927 merging) which would allow dev's to add to the query (for example to add a ->orWhere('end_date', $now) on certain collections). I had the code all written but forgot that hadn't merged to core yet!

@martyf
Copy link
Contributor

martyf commented Jan 14, 2024

This is superb, thank you Ryan.

Another PR when the query scope gets merged is definitely appreciated!

@martyf martyf merged commit 342942d into mitydigital:main Jan 14, 2024
@ryanmitchell ryanmitchell deleted the feature/refactor-to-invalidate-entries branch January 15, 2024 06:11
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.

None yet

2 participants