ratelimit

package
v0.0.0-...-849f898 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RateLimitOnBucket

type RateLimitOnBucket struct {
	// contains filtered or unexported fields
}

限流策略:

令牌桶模式
当令牌桶的 capacity 为 1 时,退化为 滴漏模式

func NewRateLimitOnBucket

func NewRateLimitOnBucket(capacity, rate int) *RateLimitOnBucket

func NewRateLimitOnDraining

func NewRateLimitOnDraining(rate int) *RateLimitOnBucket

func (*RateLimitOnBucket) IsAllow

func (this *RateLimitOnBucket) IsAllow() bool

func (*RateLimitOnBucket) Run

func (this *RateLimitOnBucket) Run() error

func (*RateLimitOnBucket) Stop

func (this *RateLimitOnBucket) Stop() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL