优化代码

This commit is contained in:
GoEdgeLab
2023-08-08 15:39:00 +08:00
parent 72c390fba5
commit 2a5aefe7f1
22 changed files with 27 additions and 53 deletions

View File

@@ -1276,13 +1276,6 @@ func (this *FileStorage) increaseHit(key string, hash string, reader Reader) {
this.hotMapLocker.Lock()
hotItem, ok := this.hotMap[key]
// 限制热点数据存活时间
var unixTime = time.Now().Unix()
var expiresAt = reader.ExpiresAt()
if expiresAt <= 0 || expiresAt > unixTime+HotItemLifeSeconds {
expiresAt = unixTime + HotItemLifeSeconds
}
if ok {
hotItem.Hits++
} else if len(this.hotMap) < HotItemSize { // 控制数量