Documentation ¶
Index ¶
- Constants
- func AddRateLimitRecord(ctx context.Context, key string, period time.Duration, maxTimes int64) (hitRateLimit bool, err error)
- func Init(redisClient *redis.Client) error
- func Lock(ctx context.Context, lockKey string, options ...LockOption) (token string, err error)
- func Unlock(ctx context.Context, lockKey, token string) error
- type LockOption
- type LockOptions
- type Locker
Constants ¶
View Source
const ( // RateLimitTtl 请求记录在redis的存储时间 RateLimitTtl = time.Minute )
Variables ¶
This section is empty.
Functions ¶
func AddRateLimitRecord ¶
Types ¶
type LockOption ¶
type LockOption struct {
// contains filtered or unexported fields
}
type LockOptions ¶
type LockOptions []LockOption
Click to show internal directories.
Click to hide internal directories.