【文件属性】:
文件名称:LeakyBucket:Leaky Bucket算法PHP实现
文件大小:10KB
文件格式:ZIP
更新时间:2021-04-28 21:43:17
PHP
漏斗
Leaky Bucket是一种算法,其工作原理如下:
有一个水桶。
铲斗具有规定的泄漏量和规定的容量。
铲斗以恒定的速度泄漏。
满溢时,不会将其他滴液添加到存储桶中。
用法
基本用法
<?php
use LeakyBucket \ LeakyBucket ;
use LeakyBucket \ Storage \ RedisStorage ;
// Define which storage to use
$ storage = new RedisStorage ();
// Define the bucket
$ settings = [
'capacity' => 10 ,
'leak' => 1
];
// Create the bucket
$ bucket = new LeakyBucket ( 'example-bucket' , $ st
【文件预览】:
LeakyBucket-master
----composer.json(597B)
----.travis.yml(298B)
----phpunit.xml(422B)
----tests()
--------LeakyBucketTest.php(4KB)
----LICENSE(1KB)
----src()
--------LeakyBucket()
----.gitignore(72B)
----README.md(3KB)