package
module
Version:
v0.0.0-...-f0e37fe
Opens a new window with list of versions in this module.
Published: Jan 13, 2021
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
limiter
使用channel制作的限流算法,代码量极少。基本的原理就是把channel的那个队列当成令牌筒,channel天生的多线程安全。
_test.go
中的test是一个例子:2秒钟,限流10次数,然后往复运动。
Documentation
¶
限流器
限流器的初始阶段是可以承受 number个数据的流量的。
限流器工作,取出令牌,每次取出一个。chan就是每次加入一个。
Source Files
¶
Click to show internal directories.
Click to hide internal directories.