hirokws/callkeeper
Composer 安装命令:
composer require hirokws/callkeeper
包简介
Sequential API call/access rate keeper to be under limited rate.
README 文档
README
Limit API calling to keep under limited rate per an unit time.
This implement is logic without using timer. So simple and light weight.
単位時間内でAPIの呼び出し回数を制限する。
タイマーを使用しない簡単なロジックで実装しているため、シンプルで軽い。
Laravelのワーカーとして利用するために開発したもの。APIコントロールは1常駐プロセスで行うと簡単に実現できる。
Usage
require __DIR__ . '/vendor/autoload.php';
use Callkeeper\Callkeeper;
...
/* Initialize */
$keep = new Callkeeper(3, 3000); // 3 times per 3,000 ms (3 seconds)
/* check and wait if needed */
$keep->limit();
$response = WebApiCalling(...);
...
Caution
This is simple keeper, so it is not thread safe. Also not async calling safe.
This is for sequential calling for single system from one process/thread.
License
MIT License.
Copyright reserved by Hirohisa Kawase.
Addition
Sorry for no test. It is hard to write tests for this type library... :P :D
统计信息
- 总下载量: 25
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-12-02