*/ public function get(): array { if (!config('koel.cache_media')) { return $this->query(); } return $this->cache->rememberForever(self::CACHE_KEY, fn (): array => $this->query()); } /** * Query fresh data from the database. * * @return array */ private function query(): array { return [ 'albums' => Album::query()->orderBy('name')->get(), 'artists' => Artist::query()->orderBy('name')->get(), 'songs' => Song::all(), ]; } public function clear(): void { $this->cache->forget(self::CACHE_KEY); } }