支持内存的流控实现
This commit is contained in:
27
memory_test.go
Normal file
27
memory_test.go
Normal file
@ -0,0 +1,27 @@
|
||||
// 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))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user