Clearing cache in kirby 3

Hello, We’ve just installed kirby 3 for our website and are excited to start using it. In looking over the page there are a few questions I have:

  1. Are these the correct instructions for clearing cache on the server?
  2. How often is the cache cleared and is there a way to manually clear the cache?
    Thanks, Ben

Have you set up your own file cache, or are using something like memcached? I don’t know if memcached is any different, but i’m pretty sure the default life of the build in file cache is 30 minutes, but as described in the link you posted, you can adjust that.

You can also make an api route you can hit to clear the cache, I’ve never done this so cant tell you much on actually implementing it but a working example is the Shopify plugin if want some code to refer to. It is set up to accept web hooks from Shopify to clear the cache of products stored in the the kirby cache. Pretty sure you need to authenticate in some way for it work though.

You can do it on demand from within the panel via the Janitor plugin or probably a page / file hook.

Lastly, you can always just simply delete the cache folder, and the cache will get regenerated next time the site is visited.

The pages cache is automatically cleared when new pages are created or existing pages or their files are updated. You don’t have to do anything yourself to achieve this.

Yes, you can clear the cache manually, e.g. via a cron job or a hook.

1 Like