Я использую PHP в качестве серверной части для своего веб-сервиса, мне нужно, чтобы веб-сервис мог установить ограничение скорости не более 1000 запросов в течение последних 24 часов в зависимости от сеанса PHP пользователя. Возможно ли это сделать без использования базы данных и просто ограничить скорость, используя только PHP. В настоящее время я уже установил ограничитель скорости для 1 запроса в секунду за сеанс, но я хочу установить ограничение скорости в 1000 запросов за сеанс за последние 24 часа. PS Я новичок в PHP, любая помощь будет отличной.
Вот код, который я сделал для ограничения скорости 1 в секунду.
class gaqsession {
public $lastrequest;
public function __construct() {
$this->lastrequest = time();
}
public function ratelimited() {
if($this->lastrequest == time()) {
$this->lastrequest = time();
return true;
} else {
$this->lastrequest = time();
return false;
}
}
}