mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-01 13:20:26 +08:00
文件缓存增加自动限速/提升本地缓存数据库写入和查询速度
This commit is contained in:
28
internal/caches/max_open_files_test.go
Normal file
28
internal/caches/max_open_files_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package caches_test
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeNode/internal/caches"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestNewMaxOpenFiles(t *testing.T) {
|
||||
var maxOpenFiles = caches.NewMaxOpenFiles(2)
|
||||
maxOpenFiles.Fast()
|
||||
t.Log(maxOpenFiles.Max())
|
||||
|
||||
maxOpenFiles.Fast()
|
||||
time.Sleep(1 * time.Second)
|
||||
t.Log(maxOpenFiles.Max())
|
||||
|
||||
maxOpenFiles.Slow()
|
||||
t.Log(maxOpenFiles.Max())
|
||||
|
||||
maxOpenFiles.Slow()
|
||||
t.Log(maxOpenFiles.Max())
|
||||
|
||||
maxOpenFiles.Slow()
|
||||
t.Log(maxOpenFiles.Max())
|
||||
}
|
||||
Reference in New Issue
Block a user