coryd.dev/app/Classes/BookFetcher.php

24 lines
468 B
PHP

<?php
namespace App\Classes;
class BookFetcher extends PageFetcher
{
public function fetch(string $url): ?array
{
$cacheKey = "book_" . md5($url);
$cached = $this->cacheGet($cacheKey);
if ($cached) return $cached;
$book = $this->fetchSingleFromApi("optimized_books", $url);
if (!$book) return null;
$book['globals'] = $this->getGlobals();
$this->cacheSet($cacheKey, $book);
return $book;
}
}