Documentation
¶
Index ¶
- func IsValidPeriod(period string) bool
- type Limiter
- type LimiterConf
- type Options
- type RedisClient
- func (c *RedisClient) RateDel(ctx context.Context, key string) error
- func (c *RedisClient) RateEvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) (interface{}, error)
- func (c *RedisClient) RateGet(ctx context.Context, key string) (interface{}, error)
- func (c *RedisClient) RateScriptLoad(ctx context.Context, script string) (string, error)
- func (c *RedisClient) RateSet(ctx context.Context, key string, max string) error
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidPeriod ¶
Types ¶
type Limiter ¶
type Limiter struct {
Confs map[string]*LimiterConf
// contains filtered or unexported fields
}
Limiter struct.
func NewLimiter ¶
type LimiterConf ¶
type Options ¶
type Options struct {
Ctx context.Context
Client RedisClient
Confs map[string]int // key: Second/Minute/Hour/Day val: limit value
}
Options for Limiter
type RedisClient ¶
Implements RedisClient for redis.Client
func (*RedisClient) RateEvalSha ¶
func (*RedisClient) RateGet ¶
func (c *RedisClient) RateGet(ctx context.Context, key string) (interface{}, error)
func (*RedisClient) RateScriptLoad ¶
Click to show internal directories.
Click to hide internal directories.