mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-25 06:17:36 +01:00
af37717108
This is a follow-up for 057698f7fb
22 lines
448 B
Go
22 lines
448 B
Go
package opentsdbhttp
|
|
|
|
import (
|
|
"github.com/valyala/fastjson"
|
|
)
|
|
|
|
// GetJSONParser returns JSON parser.
|
|
//
|
|
// The parser must be returned to the pool via PutJSONParser when no longer needed.
|
|
func GetJSONParser() *fastjson.Parser {
|
|
return parserPool.Get()
|
|
}
|
|
|
|
// PutJSONParser returns p to the pool.
|
|
//
|
|
// p cannot be used after returning to the pool.
|
|
func PutJSONParser(p *fastjson.Parser) {
|
|
parserPool.Put(p)
|
|
}
|
|
|
|
var parserPool fastjson.ParserPool
|