Skip to content

Orlion/bbr-limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bbr-limiter

php自适应限流 https://github.com/go-kratos/aegis/tree/main/ratelimit/bbr 的PHP实现

使用

class MyCpu implements Cpu
{
    public function usage(): float
    {
        return 100;
    }
}

$limiter = Limiter::builder()->locker(new FileRWLock('/tmp/bbr-limiter.test.lock'))->storager(new ApcuStorager())->cpu(new MyCpu())->cpuThreshold(80.00)->window(10)->bucket(100)->build();
if (!$limiter->allow()) {
    throw new Exception('request drop');
}

About

php自适应限流

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages