更新TeaGo

This commit is contained in:
GoEdgeLab
2020-10-20 20:30:02 +08:00
parent f1ffe8c438
commit de5ae8036c
4 changed files with 5 additions and 22 deletions

View File

@@ -3,6 +3,7 @@ package caches
import (
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeNode/internal/logs"
"github.com/iwind/TeaGo/lists"
"strconv"
"sync"
)
@@ -34,7 +35,7 @@ func (this *Manager) UpdatePolicies(newPolicies []*serverconfigs.HTTPCachePolicy
// 停止旧有的
for _, oldPolicy := range this.policyMap {
if !this.containsInt64(newPolicyIds, oldPolicy.Id) {
if !lists.ContainsInt64(newPolicyIds, oldPolicy.Id) {
logs.Error("CACHE", "remove policy "+strconv.FormatInt(oldPolicy.Id, 10))
delete(this.policyMap, oldPolicy.Id)
storage, ok := this.storageMap[oldPolicy.Id]
@@ -130,13 +131,3 @@ func (this *Manager) NewStorageWithPolicy(policy *serverconfigs.HTTPCachePolicy)
}
return nil
}
// 可判断一组数字中是否包含某数
func (this *Manager) containsInt64(values []int64, value int64) bool {
for _, v := range values {
if v == value {
return true
}
}
return false
}