For complex sites with lots of content or high amounts of traffic it might make sense to switch on Kirby's cache. Kirby' cache stores the entire result of a rendered page. As long as the cache is valid, visitors will be served the cached version which is pretty close in performance to a static html file.
Activating the cache
The cache can be activated in
You can ignore pages from being cached, by adding their URI to the
c::set('cache.ignore', array( 'home', 'projects/project-a', 'search' ));
Kirby has three built-in cache drivers. The default driver is a simple file cache. The cache driver can be changed in your config file:
// valid values: file|memcached|apc c::set('cache.driver', 'memcached');
The default cache driver stores files in
/site/cache. Make sure that the cache directory is writable by PHP in order to make the cache work.
You can change the cache folder in the cache options like this:
c::set('cache.options', array( 'root' => 'some_folder' ));
If you are running Kirby on a VPS or dedicated server or your shared hosting company is really, really awesome you might want to make use of Memcached. It's one of the fastest available cache engines. In order to use Memcached the Memcached server must be running and the Memcached PHP extension must be installed.
By default the Memcached driver is setup to use the localhost and the port 11211. You can change that with the
c::set('cache.options', array( 'host' => 'someotherhost', 'port' => 22122 ));
Another fast option is the APC cache extension for PHP. If the extension is available you can switch on the cache with…