Cache integration API reads and refresh them on a schedule
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 28s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Hickmeister
2026-10-11 19:01:32 +01:00
co-authored by Claude Sonnet 5.5
parent 8bee8d42c7
commit 2fe4fbd91e
10 changed files with 253 additions and 24 deletions
+6 -1
View File
@@ -8,7 +8,7 @@ use Throwable;
class Bambuddy
{
public function __construct(private IntegrationSettings $settings) {}
public function __construct(private IntegrationSettings $settings, private IntegrationCache $cache) {}
public function url(): string
{
@@ -26,6 +26,11 @@ class Bambuddy
throw new RuntimeException('BamBuddy API key is not configured.');
}
return $this->cache->remember('bambuddy.printers.'.md5($this->url()), 45, fn (): array => $this->fetchPrinters());
}
private function fetchPrinters(): array
{
$url = rtrim($this->url(), '/').'/api/v1/printers';
$apiKey = $this->settings->for('bambuddy')['api_key'];