Documentation
¶
Index ¶
- Constants
- type BaseRateLimiter
- type Counter
- type CounterLimiter
- type LeakyBucketLimiter
- type Limiter
- func NewCounterRateLimiter(client redis.Cmdable, key string, duration time.Duration, throughput int, ...) (Limiter, error)
- func NewLeakyBucketLimiter(client redis.Cmdable, key string, duration time.Duration, throughput int) (Limiter, error)
- func NewSlideTimeWindowLimiter(throughput int, duration time.Duration, windowBuckets int) (Limiter, error)
- func NewTokenBucketRateLimiter(client redis.Cmdable, key string, duration time.Duration, throughput int, ...) (Limiter, error)
- type SlideTimeWindowLimiter
- type TokenBucketLimiter
Constants ¶
View Source
const ( TokenBucketAlg = iota CounterAlg LeakyBucketAlg )
View Source
const LeakyBucketScript = `` /* 473-byte string literal not displayed */
key Type: string
// updateTime
key -> {lastUpdateTime}* 1000000 + {microsecond}
View Source
const TokenBucketScript = `` /* 959-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseRateLimiter ¶ added in v0.0.5
nolint: govet
type Counter ¶ added in v0.0.6
func NewCounter ¶ added in v0.0.6
func NewCounter() *Counter
type CounterLimiter ¶ added in v0.0.5
type CounterLimiter struct {
BaseRateLimiter
N int64
// contains filtered or unexported fields
}
type LeakyBucketLimiter ¶ added in v0.0.5
type LeakyBucketLimiter struct {
BaseRateLimiter
// contains filtered or unexported fields
}
type Limiter ¶ added in v0.0.5
func NewCounterRateLimiter ¶ added in v0.0.5
func NewLeakyBucketLimiter ¶ added in v0.0.5
func NewSlideTimeWindowLimiter ¶ added in v0.0.6
type SlideTimeWindowLimiter ¶ added in v0.0.6
nolint: govet
func (*SlideTimeWindowLimiter) Count ¶ added in v0.0.6
func (s *SlideTimeWindowLimiter) Count() int
type TokenBucketLimiter ¶ added in v0.0.5
type TokenBucketLimiter struct {
BaseRateLimiter
N int64
// contains filtered or unexported fields
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
counter
command
|
|
|
leaky_bucket
command
|
|
|
time_window
command
|
|
|
token_bucket
command
|
Click to show internal directories.
Click to hide internal directories.