1. Go to this page and download the library: Download akibeo/kirby-cacher library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
return [
'akibeo.cacher' => [
'warmup' => [
// pages that only exist as routes or virtual pages are not in
// site()->index(); return their URLs here (closure or plain array)
'urls' => function (Kirby\Cms\App $kirby): array {
$urls = [];
foreach (['nl' => 'te-koop', 'fr' => 'fr/a-vendre'] as $segment) {
$urls[] = url($segment);
}
return $urls;
},
// page ids or fnmatch globs to leave out
'exclude' => ['search', 'account/*'],
// per-request timeout in seconds
'timeout' => 30,
// pause between two requests in milliseconds, so the site and
// any upstream APIs are not hammered
'delay' => 200,
// URLs per request when warming from the Panel
'batch' => 10,
],
],
];
cacher()->clear(); // same as the Panel button
cacher()->clearNamespace('akibeo.pricing');
cacher()->warmup(); // every URL from cacher()->warmupUrls()
cacher()->warmup([$url1, $url2]); // a subset of those URLs
cacher()->warmupUrls(); // the list the warmup uses
cacher()->stats();
// also available as site methods
site()->clearCache();
site()->clearCacheNamespace('akibeo.pricing');
site()->warmupCache();
site()->cacheStats();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.