Caching and Cache Control

This page is about the multiple possibilities to speed up the page load with the help of caching.

Introduction

Caching contents is important to deliver fast loading websites and also an important part of Google Lighthouse.

Fortunately Kiwa provides some basic setting that work out of the box. They can be changed by your needs.

Caching pages

The caching of pages means, that the whole response will be stored as a blank HTML file. This setting is disabled per default.

It can be enabled in the pages config by calling $page->enableCache().

Cache control

Kiwa sets up the cache-control by itself. The preconfigures behaviour is:

  • HTML files won't get cached
  • Versioned files will be marked as immutable and cached for 1 year
  • Unversioned files will be cached for 1 day

This behaviour can be changed over the Response object, it can be accessed over DI::getResponse().