throttle
1.0.0
ติดตั้งด้วยนักแต่งเพลง
composer require zeus/throttleตั้งค่าข้อ จำกัด การร้องขอ HTTP เช่นการเข้าถึงเพียง 100 ครั้งใน 10 นาที 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 ();