protected function getNewRatio($key, $limit, $milliseconds)
{
$lastRequest = $this->getLastRequest($key) ?: 0;
$lastRatio = $this->getLastRatio($key) ?: 0;
$diff = (microtime(1) - $lastRequest) * 1000;
$newRatio = $lastRatio - $diff;
$newRatio = $newRatio < 0 ? 0 : $newRatio;
$newRatio += $milliseconds / $limit;
return $newRatio;
}