redis流控 + 单元测试

This commit is contained in:
2024-06-20 18:32:16 +08:00
parent e4bd913390
commit 54a77d170a
6 changed files with 217 additions and 55 deletions

20
define/limit.go Normal file
View File

@ -0,0 +1,20 @@
// Package define ...
//
// Description : define ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2024-06-20 14:36
package define
// LimitConfig ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:17 2024/6/20
type LimitConfig struct {
Key string `json:"key"` // 操作的key
Total int `json:"total"` // 令牌桶大小
Rate int `json:"rate"` // 同步速率
TimeInterval int64 `json:"time_interval"` // 同步的时间间隔, 单位 : s
}