putyourlightson / craft-blitz

Intelligent static page caching for creating lightning-fast sites with Craft CMS.
https://putyourlightson.com/plugins/blitz
Other
149 stars 36 forks source link

Editing/updating robots.txt in SEOMatic triggers a full cache refresh #380

Closed johnwbaxter closed 2 years ago

johnwbaxter commented 2 years ago

Describe the bug

Editing/updating robots.txt in SEOMatic triggers a full cache refresh (and warm) in Blitz

To reproduce

Steps to reproduce the behaviour: Go to "Global SEO" -> "Robots" and edit the content and save

Expected behaviour

Just to update the robots.txt file

Versions

bencroker commented 2 years ago

It looks like saving any global setting in SEOmatic triggers an invalidation of all of the meta container caches, which then triggers a full refresh of the Blitz cache via the EVENT_INVALIDATE_CONTAINER_CACHES event: https://github.com/nystudio107/craft-seomatic/blob/362029c7095931150c65b3dbf957b14393f4e3f4/src/services/MetaContainers.php#L919-L940

Perhaps @khalwat can enlighten us as to whether this is intentional?

khalwat commented 2 years ago

It's intentional, but it's perhaps a bit heavy-handed in some cases. Probably editing the various frontend templates doesn't require all of the meta caches to be invalidated.

Since the "General" settings is one big form, there's one controller endpoint that handles the saving of those settings. Some settings in General do require a full invalidation, so the only way to make this less heavy-handed would be to somehow do a diff of the changes, and then figure out which ones require a full cache invalidation, and which ones don't.

In general, as you know, I'm not a huge fan of "warming" caches in general (there are some specific circumstances where it makes sense, but they are not too common).

bencroker commented 2 years ago

Thanks for clarifying, @khalwat. So the conclusion is that this is a feature, not a bug.