2020-01-24 14:52:48 +00:00
|
|
|
package opentsdbhttp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/valyala/fastjson"
|
|
|
|
)
|
|
|
|
|
2020-09-28 01:11:55 +00:00
|
|
|
// getJSONParser returns JSON parser.
|
2020-01-24 14:52:48 +00:00
|
|
|
//
|
2020-09-28 01:11:55 +00:00
|
|
|
// The parser must be returned to the pool via putJSONParser when no longer needed.
|
|
|
|
func getJSONParser() *fastjson.Parser {
|
2020-01-24 14:52:48 +00:00
|
|
|
return parserPool.Get()
|
|
|
|
}
|
|
|
|
|
2020-09-28 01:11:55 +00:00
|
|
|
// putJSONParser returns p to the pool.
|
2020-01-24 14:52:48 +00:00
|
|
|
//
|
|
|
|
// p cannot be used after returning to the pool.
|
2020-09-28 01:11:55 +00:00
|
|
|
func putJSONParser(p *fastjson.Parser) {
|
2020-01-24 14:52:48 +00:00
|
|
|
parserPool.Put(p)
|
|
|
|
}
|
|
|
|
|
|
|
|
var parserPool fastjson.ParserPool
|