Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*TokenBucketLimiter)
func WithAntiDDos ¶
func WithEnablePreFetch ¶
func WithPreFetchCount ¶
type TokenBucketLimiter ¶
type TokenBucketLimiter struct { ratelimit.BaseRateLimiter N int64 /* If the traffic is too large, the limiter will request Redis frequently. To avoid this situation, the frequency of accessing Redis will be limited. */ AntiDDoS bool /* Get the token in advance before actually needing to use it */ EnablePreFetch bool PreFetchCount int64 // contains filtered or unexported fields }
func (*TokenBucketLimiter) PreFetch ¶
func (r *TokenBucketLimiter) PreFetch()
Click to show internal directories.
Click to hide internal directories.