CodeExplorer ReserveNotSupportedException example
StorageInterface
$storage,
LockInterface|null
$lock =
new NoLock() ) { $this->id =
$id;
$this->reset = TimeUtil::
dateIntervalToSeconds($reset);
$this->storage =
$storage;
$this->lock =
$lock;
} public function reserve(int
$tokens = 1, ?float
$maxTime = null
): Reservation
{ throw new ReserveNotSupportedException(self::
class);
} public function consume(int
$tokens = 1
): RateLimit
{ $this->lock?->
acquire(true
);
try { $backoff =
$this->storage->
fetch($this->id
);
if (!
$backoff instanceof TimeBackoff
) { $backoff =
new TimeBackoff($this->id,
$this->limits,
$this->reset
);
}