mirror of
https://github.com/CPunch/gopenfusion.git
synced 2024-11-12 19:20:06 +00:00
CPunch
5b2a8b838e
- misc. cleanup - core/db/players.go: works with core.Player types, will also grab inventory table
20 lines
256 B
Go
20 lines
256 B
Go
package pool
|
|
|
|
import (
|
|
"bytes"
|
|
"sync"
|
|
)
|
|
|
|
var allocator = &sync.Pool{
|
|
New: func() any { return new(bytes.Buffer) },
|
|
}
|
|
|
|
func Get() *bytes.Buffer {
|
|
return allocator.Get().(*bytes.Buffer)
|
|
}
|
|
|
|
func Put(buf *bytes.Buffer) {
|
|
buf.Reset()
|
|
allocator.Put(buf)
|
|
}
|