I am trying to cache an api request within a widget but it seems to save no content into the cache file…
the content from the remote request is accesable but the cache file stays empty at all times. It’s always trying to do another remote request.
// config
'cache' => [
'pages' => [
'active' => true
]
],
'cache.reviews' => true,
// snippet
$kirby = kirby();
$apiCache = $kirby->cache('reviews');
$apiData = $apiCache->get('review');
if ($apiData === null) {
$apiData = remote::request('url');
$apiCache->set('review', $apiData, 15);
}
// i can output the content just fine e.g.
$result = json_decode($apiData->content);
dump($result);
// the cache file - in this case storage/cache/reviews/review.cache
// however stays empty (0 bytes)