Documentation ¶
Index ¶
- type Limiter
- func (e *Limiter) CountLimit(ctx context.Context, key string, count, ttl int64) bool
- func (e *Limiter) SyncCountLimit(ctx context.Context, key string, count, ttl int64) bool
- func (e *Limiter) SyncWindowLimit(ctx context.Context, key string, count, windowTime int64) bool
- func (e *Limiter) WindowLimit(ctx context.Context, key string, count, windowTime int64) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
func (*Limiter) CountLimit ¶
不保证流程原子性,存在并发竞争问题
func (*Limiter) SyncCountLimit ¶
Lua脚本保证流程原子性,并发安全
func (*Limiter) SyncWindowLimit ¶
Lua脚本保证流程原子性,并发安全
Click to show internal directories.
Click to hide internal directories.