通过内存缓存提升文件缓存效率大约20%

This commit is contained in:
GoEdgeLab
2021-08-21 21:06:48 +08:00
parent 53f3a56972
commit 7a452c5a6f
6 changed files with 56 additions and 8 deletions
+7 -1
View File
@@ -5,7 +5,7 @@ import (
"time"
)
// TTL缓存
// Cache TTL缓存
// 最大的缓存时间为30 * 86400
// Piece数据结构:
// Piece1 | Piece2 | Piece3 | ...
@@ -136,6 +136,12 @@ func (this *Cache) GC() {
this.gcPieceIndex = newIndex
}
func (this *Cache) Clean() {
for _, piece := range this.pieces {
piece.Clean()
}
}
func (this *Cache) Destroy() {
this.isDestroyed = true