Skip to content

Kirby 4.4.1

cache

Enables/disables Kirby's cache and sets cache options

Enabling/disabling the cache

return [
  'cache' => [
    'pages' => [
      'active' => true
    ]
  ]
];

Cache prefix

/site/config/config.php
return [
  'cache' => [
    'pages' => [
      'active' => true,
      'prefix' => 'example.com/pages'
    ]
  ]
];

You can read more about the cache prefix in the guide.

Cache driver

Set a different cache driver, default is the file driver.

return [
  'cache' => [
    'pages' => [
      'active' => true,
      'type'   => 'memcached'
    ]
  ]
];

The following cache drivers are available:

Cache Driver Type Description
FileCache file File System Cache Driver
ApcuCache apcu Driver for Apcu cache
MemCached memcached Driver for Memcached cache server
MemoryCache memory Driver for caching the current request in memory
NullCache Dummy Cache Driver (does not do any caching)

You can also set a registered custom cache driver here. Check out the plugin reference how to create a custom cache driver.

Make sure the selected cache driver is enabled on/supported by your server.

Options for other cache types

The examples above set the options for the pages cache. You can use the same option structure for other caches, e.g. the uuid cache:

return [
  'cache' => [
    'uuid' => [
      'type' => 'memcached'
    ]
  ]
];