throttle
1.0.0
作曲家と一緒にインストールします
composer require zeus/throttle10分間の強力なRedisハンドルHTTPリクエストで100のアクセスのみなど、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 ();