Fufu
Fufu
https://github.com/xinliangnote/go-gin-api/blob/4c37a7e6b571b29b91c59a129c52cea8e899e7a2/internal/pkg/core/core.go#L527 代码中固定了 每秒只产生 1 个令牌, 即当初始的 10000 个消费完成后, 就只能 1 秒 1 个请求了. 可以发起 20000 个请求测试一下. 另外, 建议最好放到配置文件里, 而不是常量配置.
```go package main import ( "strings" "time" cache "github.com/chenyahui/gin-cache" "github.com/chenyahui/gin-cache/persist" "github.com/gin-gonic/gin" "github.com/nanmu42/gzip" ) func main() { app := gin.New() app.Use(gzip.DefaultHandler().Gin) memoryStore := persist.NewMemoryStore(1 * time.Minute) body := strings.Repeat("hello world", 100)...
In actual use, some necessary methods have been added. If you find it useful, you can refer to it or merge it. Of course, you can simply refuse. ```go go...
Fixes: #25 If you find it useful, you can refer to it or merge it. Of course, you can simply refuse. ``` go test -v -run=TestTickerSecond === RUN TestTickerSecond ---...