更新接口约束

This commit is contained in:
2024-06-20 20:39:53 +08:00
parent 40bfaafa5a
commit 7c31a1111e
2 changed files with 0 additions and 23 deletions

View File

@ -10,7 +10,6 @@ package abstract
import (
"context"
"git.zhangdeman.cn/zhangdeman/rate_limit/define"
"github.com/redis/go-redis/v9"
)
// IRateLimit 流控实现接口约束
@ -19,14 +18,6 @@ import (
//
// Date : 11:33 2024/6/20
type IRateLimit interface {
// Second(ctx context.Context, key string, total, rate int) (bool, error) // 每秒访问次数限制
// Minute(ctx context.Context, key string, total, rate int) (bool, error) // 每分钟访问次数限制
// Hour(ctx context.Context, key string, total, rate int) (bool, error) // 每小时访问次数限制
// Day(ctx context.Context, key string, total, rate int) (bool, error) // 每天访问次数限制
// Month(ctx context.Context, key string, total, rate int) (bool, error) // 每月访问次数限制
// Year(ctx context.Context, key string, total, rate int) (bool, error) // 每年访问次数限制
// Custom(ctx context.Context, timeInfo int64, key string, total, rate int) (bool, error) // 自定义指定时间内的访问次数, timeInfo 单位 : s
SetRedisClient(client *redis.Client) // 设置redis客户端
AllowN(ctx context.Context, limitCfg *define.LimitConfig, tokenCnt int) (bool, error) // 申请N个令牌, N >= 0
Reset(ctx context.Context, limitCfg *define.LimitConfig) error // 重置
}