mirror of
https://gitee.com/wanwujie/sub2api
synced 2026-04-13 19:34:45 +08:00
25 lines
434 B
Go
25 lines
434 B
Go
|
|
package service
|
||
|
|
|
||
|
|
import "sync"
|
||
|
|
|
||
|
|
const sseScannerBuf64KSize = 64 * 1024
|
||
|
|
|
||
|
|
type sseScannerBuf64K [sseScannerBuf64KSize]byte
|
||
|
|
|
||
|
|
var sseScannerBuf64KPool = sync.Pool{
|
||
|
|
New: func() any {
|
||
|
|
return new(sseScannerBuf64K)
|
||
|
|
},
|
||
|
|
}
|
||
|
|
|
||
|
|
func getSSEScannerBuf64K() *sseScannerBuf64K {
|
||
|
|
return sseScannerBuf64KPool.Get().(*sseScannerBuf64K)
|
||
|
|
}
|
||
|
|
|
||
|
|
func putSSEScannerBuf64K(buf *sseScannerBuf64K) {
|
||
|
|
if buf == nil {
|
||
|
|
return
|
||
|
|
}
|
||
|
|
sseScannerBuf64KPool.Put(buf)
|
||
|
|
}
|