修复内存缓存没有init()的Bug

This commit is contained in:
GoEdgeLab
2021-06-12 10:03:33 +08:00
parent ab3d624bb8
commit 117bcaaf0a

View File

@@ -46,6 +46,8 @@ func NewMemoryStorage(policy *serverconfigs.HTTPCachePolicy) *MemoryStorage {
// Init 初始化 // Init 初始化
func (this *MemoryStorage) Init() error { func (this *MemoryStorage) Init() error {
_ = this.list.Init()
this.list.OnAdd(func(item *Item) { this.list.OnAdd(func(item *Item) {
atomic.AddInt64(&this.totalSize, item.TotalSize()) atomic.AddInt64(&this.totalSize, item.TotalSize())
}) })