The core cache system in Kirby 3

I can’t find that much info about the cache functionality in Kirby 3. If I enable it I can see that it generates cache files for each page in my cache folder. Great. But when and how does the cache clear?

Is the cache being cleared every time something is saved in the Panel?
What about when something is changed with an API request?
Can I clear the cache myself programmatically in a plugin?

Thanks for helping me understand.

Yes, and when files are uploaded, statuses changed etc. the cache is quite brutal in that respect, as Kirby doesn’t know what changes affect what page.


Since the Panel also uses the API, I would think that yes, but not sure.

This is the code you’d need in your plugin to empty the core pages cache: