Bringing up an old topic here – I’d love to have the option of disabling the the cache clearing automatically.
I’ve recently started using Kirby as a CMS and API: delivering content as JSON with custom routes. I’m caching most of these calls, and selectively clearing them when my users update content.
In my current project, I’ve ‘solved’ this by hacking the core cache driver in the toolkit:
public function flush($force = false) {
if ($force) return dir::clean($this->options['root']);
}
then I can manually flush the cache with a route:
array(
'method' => 'GET',
'pattern' => 'api/flushcache',
'action' => function() {
$cleared = kirby()->cache()->flush(true);
return response::json(json_encode($cleared));
}
),
Like this, it’s working wonderfully. Of course, I’ve had to ensure that particular cache items are cleared.
Or, is there a way to create and use a separate cache that is not cleared by the panel?