github.com/orangebees/go-oneutils@v0.0.10/GlobalStore/FileInfoMapPool.go (about) 1 package GlobalStore 2 3 import "sync" 4 5 var poolFileInfoMap = sync.Pool{ 6 New: func() any { 7 return make(FileInfoMap, 16) 8 }, 9 } 10 11 func (m FileInfoMap) Reset() { 12 for k, v := range m { 13 ReleaseFileInfo(v) 14 delete(m, k) 15 } 16 } 17 func AcquireFileInfoMap() FileInfoMap { 18 return poolFileInfoMap.Get().(FileInfoMap) 19 } 20 21 func ReleaseFileInfoMap(m FileInfoMap) { 22 m.Reset() 23 poolFileInfoMap.Put(m) 24 }