mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 23:24:01 +03:00
FILE / ScuroNeko/mtg
stats/pools.go
Исходный файл и его история в репозитории.
21 lines
344 B
Go
21 lines
344 B
Go
package stats
|
|
|
|
import "sync"
|
|
|
|
var streamInfoPool = sync.Pool{
|
|
New: func() any {
|
|
return &streamInfo{
|
|
tags: make(map[string]string),
|
|
}
|
|
},
|
|
}
|
|
|
|
func acquireStreamInfo() *streamInfo {
|
|
return streamInfoPool.Get().(*streamInfo) //nolint: forcetypeassert
|
|
}
|
|
|
|
func releaseStreamInfo(info *streamInfo) {
|
|
info.Reset()
|
|
streamInfoPool.Put(info)
|
|
}
|