优化代码:使用fasttime取代以往的utils.UnixTime

This commit is contained in:
GoEdgeLab
2023-04-08 12:47:04 +08:00
parent 511e0d409f
commit f3da37046a
22 changed files with 208 additions and 137 deletions

View File

@@ -2,6 +2,7 @@ package ttlcache
import (
"github.com/TeaOSLab/EdgeNode/internal/utils"
"github.com/TeaOSLab/EdgeNode/internal/utils/fasttime"
"time"
)
@@ -74,7 +75,7 @@ func (this *Cache) Write(key string, value interface{}, expiredAt int64) (ok boo
return
}
var currentTimestamp = utils.UnixTime()
var currentTimestamp = fasttime.Now().Unix()
if expiredAt <= currentTimestamp {
return
}