mirror of https://github.com/gofiber/fiber.git
21 lines
302 B
Go
21 lines
302 B
Go
package dictpool
|
|
|
|
import "sync"
|
|
|
|
var defaultPool = sync.Pool{
|
|
New: func() interface{} {
|
|
return new(Dict)
|
|
},
|
|
}
|
|
|
|
// AcquireDict acquire new dict.
|
|
func AcquireDict() *Dict {
|
|
return defaultPool.Get().(*Dict)
|
|
}
|
|
|
|
// ReleaseDict release dict.
|
|
func ReleaseDict(d *Dict) {
|
|
d.Reset()
|
|
defaultPool.Put(d)
|
|
}
|