rlc
Go的速率限制器集合。
挑选一个限速器来限制请求并控制配额。
RLC
RLC是一个速率限制器,它根据先前请求的状态来管理配额,并相应地减慢或加速。
用法
offset := rlc . NewRandomOffset ( 96 )
// an RLC with the bitmap size of 96 with 16 reserved
// positive bits and the random offset manager
eq := rlc . NewRLC ( 96 , 16 , offset )
// non-blocking quota request
haveQuota := eq . Ask ()
// update with ten previous successful requests
eq . Notify ( true , 10 )
基准测试
Be
2021-03-25 13:07:10
9KB
Go
1