added wss tools 7
This commit is contained in:
@@ -33,6 +33,18 @@ class LivePriceCacheService
|
||||
|
||||
public function put(array $body): array
|
||||
{
|
||||
$cached = Cache::get(self::FULL_RESPONSE_KEY);
|
||||
$cachedBody = is_array($cached['body'] ?? null) ? $cached['body'] : null;
|
||||
|
||||
if ($cachedBody !== null && PriceBroadcastService::lastPriceIdentity($cachedBody) === PriceBroadcastService::lastPriceIdentity($body)) {
|
||||
Cache::put(self::FULL_RESPONSE_KEY, [
|
||||
'body' => $cachedBody,
|
||||
'stored_at' => now(),
|
||||
], now()->addSeconds(self::TTL_SECONDS + 5));
|
||||
|
||||
return $cachedBody;
|
||||
}
|
||||
|
||||
Cache::put(self::FULL_RESPONSE_KEY, [
|
||||
'body' => $body,
|
||||
'stored_at' => now(),
|
||||
|
||||
Reference in New Issue
Block a user