throttle
1.0.0
Установите с помощью композитора
composer require zeus/throttleУстанавливает HTTP -ограничения запроса, например, только 100 доступа за 10 минут Mater Redis обрабатывает HTTP -запросы, вы можете легко интегрировать его во все API или проекты
use Throttle Throttle ;
use Throttle Time ;
$ throttle = new Throttle (
new Time ( 60 , 25 )
);
$ throttle -> commit ();
if ( $ throttle -> isHasAccessLimit ()) {
print ' request can go next ' ;
} else {
print ' max request amount ' ;
}
use Throttle Throttle ;
use Throttle Time ;
use Throttle Redis ;
Redis:: setRedisClient ( new Predis Client ( $ params ));
$ throttle = new Throttle (
new Time ( 60 , 25 )
);
$ throttle -> commit ();
if ( $ throttle -> isHasAccessLimit ()) {
print ' request can go next ' ;
} else {
print ' max request amount ' ;
}Получите детали
$ throttle -> getDetail ()-> toArray ();