getLocale(), can_user_interact() ? 'authenticated' : null, ]), ); if (! ($found = cache($cacheName))) { $found = view('pages/map', [], [ 'cache' => DECADE, 'cache_name' => $cacheName, ]); } return $found; } public function getEpisodesMarkers(): ResponseInterface { $cacheName = 'episodes_markers'; if (! ($found = cache($cacheName))) { $episodes = (new EpisodeModel()) ->where('`published_at` <= NOW()', null, false) ->where('location_geo is not', null) ->findAll(); $found = []; foreach ($episodes as $episode) { $found[] = [ 'latitude' => $episode->location->latitude, 'longitude' => $episode->location->longitude, 'location_name' => $episode->location->name, 'location_url' => $episode->location->url, 'episode_link' => $episode->link, 'podcast_link' => $episode->podcast->link, 'cover_url' => $episode->cover->thumbnail_url, 'podcast_title' => $episode->podcast->title, 'episode_title' => $episode->title, ]; } // The page cache is set to a decade so it is deleted manually upon episode update cache() ->save($cacheName, $found, DECADE); } return $this->response->setJSON($found); } }