优化内存缓存写入速度

This commit is contained in:
GoEdgeLab
2024-01-22 10:28:23 +08:00
parent 1b1ceacc75
commit e290c3209e

View File

@@ -48,6 +48,10 @@ func NewMemoryWriter(memoryStorage *MemoryStorage, key string, expiredAt int64,
SharedFragmentMemoryPool.IncreaseNew() SharedFragmentMemoryPool.IncreaseNew()
} }
} }
} else {
if expectedBodySize > 0 {
valueItem.BodyValue = make([]byte, 0, expectedBodySize)
}
} }
var w = &MemoryWriter{ var w = &MemoryWriter{
storage: memoryStorage, storage: memoryStorage,