feat(*.php): refactor, clean up and abstract dynamic page code

This commit is contained in:
Cory Dransfeldt 2025-05-14 17:22:35 -07:00
parent 2f9038dccb
commit 60be0ed01d
No known key found for this signature in database
30 changed files with 318 additions and 401 deletions

View file

@ -0,0 +1,19 @@
<?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;
$this->cacheSet($cacheKey, $book);
return $book;
}
}