优化热门缓存算法

This commit is contained in:
刘祥超
2023-10-02 10:40:20 +08:00
parent 3781b1920a
commit ae1454f9bb

View File

@@ -1170,6 +1170,9 @@ func (this *FileStorage) hotLoop() {
var result = []*HotItem{} // [ {key: ..., hits: ...}, ... ] var result = []*HotItem{} // [ {key: ..., hits: ...}, ... ]
for _, v := range this.hotMap { for _, v := range this.hotMap {
if v.Hits <= 1 {
continue
}
result = append(result, v) result = append(result, v)
} }