TtlRateProvider
in package
implements
RateProvider
FinalYes
Кэш с временем жизни. Часы передаются замыканием now(): int, чтобы не тащить внешний пакет.
Table of Contents
Interfaces
- RateProvider
- Источник курса для пары валют.
Properties
- $inner : RateProvider
- $now : Closure
- $stored : array<string, ExchangeRate, at: int}>
- $ttlSeconds : int
Methods
- __construct() : mixed
- get() : ExchangeRate
Properties
$inner read-only
private
RateProvider
$inner
$now read-only
private
Closure
$now
$stored
private
array<string, ExchangeRate, at: int}>
$stored
= []
$ttlSeconds read-only
private
int
$ttlSeconds
Methods
__construct()
public
__construct(RateProvider $inner, int $ttlSeconds, callable(): int $now) : mixed
Parameters
- $inner : RateProvider
- $ttlSeconds : int
- $now : callable(): int
Tags
get()
public
get(CurrencyPair $pair) : ExchangeRate
Parameters
- $pair : CurrencyPair
Attributes
- #[Override]