What would be the best way to bust cache daily?

I’d like to cache all pages on my website (Kirby-staticache plugin looks perfect for me), but I’d like the cache to only last 24 hours ; some stuff on my site changes every day so it makes sense to cache pages once a day. What would be the best way to go about it?

  • a daily cron job that deletes the static cache directory
  • a cron job that calls a PHP script that calls the Kirby API to update a field on a page
  • a hidden setting in the cache API to set an expiry date

Thanks in advance!

From the static cache plugins readme…

The static cache will automatically be flushed whenever content gets updated in the Panel.

No good?

Thanks!
When I said,

some stuff on my site changes every day so it makes sense to cache pages once a day

I didn’t mean “I log in and update some content every day through the panel”, but more “some PHP is executed, that will display different things every day”. I want to know if I can benefit from a caching solution to cache the pages every day, not every time I update the content on that website (which can wait weeks to months to be updated).

A cron job that flushes the cache once a day: $cache->flush() | Kirby CMS or deleting the static cache folder

1 Like

Oh, that’s perfect, thank you!