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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache Clear Trigger doesn't fire for entries scheduled in future #67

Open
hmcleek opened this issue Jul 13, 2023 · 1 comment
Open

Cache Clear Trigger doesn't fire for entries scheduled in future #67

hmcleek opened this issue Jul 13, 2023 · 1 comment

Comments

@hmcleek
Copy link

hmcleek commented Jul 13, 2023

Issue: Client schedules a blog post for the morning on the night before a post, but the entry goes live without the cache clearing, leaving the blog missing from the blog listing page. The Cache Clear Trigger is set to "When entries are updated in any way" and the Cache Clear Strategy is "Full Purge".

Expected behavior: entry changes from Pending to Live and triggers a cache clearance.

Happy to provide additional context if necessary. Thank you!

@mattgrayisok
Copy link
Collaborator

Hey @hmcleek. This is always a difficult problem to solve as there's no specific 'event' which occurs at the time of the post going live to trigger the cache clear. Short term the simplest solution is to reduce the cache TTL so that pages are updated more frequently, this can also be done on a per page basis by setting Servd's static cache to 'Use Origin Headers' and then returning cache-control headers from pages with unique values. This would allow you to set a cache TTL of 2 mins (for example) for an article listing page, whilst keeping the majority of pages at a higher value. That setup tends to works well for the situation you're talking about.

The alternative option is to run a cron which runs every x minutes and checks the database for entries with a go-live date within the last x minutes, then flushes the cache if it finds one. There would still be a delay between the go-live date of the article and the cron running though. I'll consider that a feature request and see if it can be slotted into the Servd Plugin.

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

No branches or pull requests

2 participants