feat(*): refactor dynamic vs. static structure and distinctions; make additional elements dynamic
This commit is contained in:
parent
7a0b808f24
commit
69da20fd8e
127 changed files with 984 additions and 956 deletions
|
@ -11,21 +11,18 @@ abstract class PageFetcher extends BaseHandler
|
|||
|
||||
protected function cacheGet(string $key): mixed
|
||||
{
|
||||
return $this->cache && $this->cache->exists($key)
|
||||
? json_decode($this->cache->get($key), true)
|
||||
: null;
|
||||
return $this->cache && $this->cache->exists($key) ? json_decode($this->cache->get($key), true) : null;
|
||||
}
|
||||
|
||||
protected function cacheSet(string $key, mixed $value, int $ttl = 3600): void
|
||||
protected function cacheSet(string $key, mixed $value, int $ttl = 300): void
|
||||
{
|
||||
if ($this->cache) {
|
||||
$this->cache->setex($key, $ttl, json_encode($value));
|
||||
}
|
||||
if ($this->cache) $this->cache->setex($key, $ttl, json_encode($value));
|
||||
}
|
||||
|
||||
protected function fetchSingleFromApi(string $endpoint, string $url): ?array
|
||||
{
|
||||
$data = $this->fetchFromApi($endpoint, "url=eq./{$url}");
|
||||
|
||||
return $data[0] ?? null;
|
||||
}
|
||||
|
||||
|
@ -39,6 +36,7 @@ abstract class PageFetcher extends BaseHandler
|
|||
if ($this->globals !== null) return $this->globals;
|
||||
|
||||
$fetcher = new GlobalsFetcher();
|
||||
|
||||
$this->globals = $fetcher->fetch();
|
||||
|
||||
return $this->globals;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue