28 lines
499 B
Go
28 lines
499 B
Go
|
// Package rate_limit ...
|
||
|
//
|
||
|
// Description : rate_limit ...
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 2024-06-20 20:55
|
||
|
package rate_limit
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"fmt"
|
||
|
"git.zhangdeman.cn/zhangdeman/rate_limit/define"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestMemory_AllowN(t *testing.T) {
|
||
|
|
||
|
for i := 0; i < 10; i++ {
|
||
|
fmt.Println(MemoryClient.AllowN(context.Background(), &define.LimitConfig{
|
||
|
Key: "deman",
|
||
|
Total: 15,
|
||
|
Rate: 10,
|
||
|
TimeInterval: 10,
|
||
|
}, 8))
|
||
|
}
|
||
|
}
|