Documentation ¶
Overview ¶
Package limiter 限制器 可以用于防止短时间内大量请求同时处理,比如缓存防击穿,防爬虫等
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Defaultopt = Options{ WarningSize: 80, AsyncHooks: false, WarningHooks: []Hook{}, FullHooks: []Hook{}, }
Defaultopt 默认的可选配置
View Source
var ErrLimiterMaxSizeMustLargerThanWaringSize = errors.New("limiter的最大容量必须大于警戒容量")
ErrLimiterMaxSizeMustLargerThanWaringSize limiter的最大容量必须大于警戒容量
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter 分布式限制器
func New ¶
func New(cell *redis_cell.RedisCell, opts ...Option) (*Limiter, error)
FromRedisCell 从令牌桶对象中转化得到限制器
Click to show internal directories.
Click to hide internal directories.