mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-16 01:50:26 +08:00
优化计数器
This commit is contained in:
@@ -35,12 +35,14 @@ func TestItem_IsExpired(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
var currentTime = time.Now().Unix()
|
||||
|
||||
var item = counters.NewItem(10)
|
||||
t.Log(item.IsExpired())
|
||||
t.Log(item.IsExpired(currentTime))
|
||||
time.Sleep(10 * time.Second)
|
||||
t.Log(item.IsExpired())
|
||||
t.Log(item.IsExpired(currentTime))
|
||||
time.Sleep(2 * time.Second)
|
||||
t.Log(item.IsExpired())
|
||||
t.Log(item.IsExpired(currentTime))
|
||||
}
|
||||
|
||||
func BenchmarkItem_Increase(b *testing.B) {
|
||||
|
||||
Reference in New Issue
Block a user