28 lines
531 B
PHP
28 lines
531 B
PHP
<?php
|
|
|
|
namespace App\Classes;
|
|
|
|
class GenreFetcher extends PageFetcher
|
|
{
|
|
public function fetch(string $url): ?array
|
|
{
|
|
$cacheKey = 'genre_'.md5($url);
|
|
$cached = $this->cacheGet($cacheKey);
|
|
|
|
if ($cached) {
|
|
return $cached;
|
|
}
|
|
|
|
$genre = $this->fetchSingleFromApi('optimized_genres', $url);
|
|
|
|
if (! $genre) {
|
|
return null;
|
|
}
|
|
|
|
$genre['globals'] = $this->getGlobals();
|
|
|
|
$this->cacheSet($cacheKey, $genre);
|
|
|
|
return $genre;
|
|
}
|
|
}
|