chart handled 4

This commit is contained in:
2026-06-02 14:20:57 +03:30
parent f97e7a19a3
commit 5ab2d2c65e
+8 -3
View File
@@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Log;
class ZaarboxPriceService
{
public const CACHE_KEY = 'zaarbox_gold_prices';
private const CACHE_KEY_PREFIX = 'zaarbox_gold_prices';
private const CACHE_TTL_MINUTES = 35;
@@ -33,9 +33,14 @@ class ZaarboxPriceService
return $chartId ?: self::HISTORY_ID;
}
private function cacheKey(): string
{
return self::CACHE_KEY_PREFIX . ':' . $this->historyId();
}
public function getAllPrices(): array
{
$cached = Cache::get(self::CACHE_KEY);
$cached = Cache::get($this->cacheKey());
if (is_array($cached) && isset($cached['prices'])) {
return $cached['prices'];
@@ -48,7 +53,7 @@ class ZaarboxPriceService
{
$prices = $this->fetchAllPrices();
Cache::put(self::CACHE_KEY, [
Cache::put($this->cacheKey(), [
'prices' => $prices,
'refreshed_at' => now()->toIso8601String(),
], now()->addMinutes(self::CACHE_TTL_MINUTES));