mirror of
https://github.com/gofiber/fiber.git
synced 2025-05-31 03:42:48 +00:00
* Bind support for Render. * update * fix tests * split Pass-locals-to-views & Bind from Render * update comments. * add benchs. * Update ctx.go Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com> * Update ctx.go * optimize * switch dictpool. * ✨ feature: bind support for render - improve performance * ✨ feature: bind support for render - improve performance Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com> Co-authored-by: wernerr <rene.werner@verivox.com> Co-authored-by: wernerr <rene@gofiber.io>
21 lines
328 B
Go
21 lines
328 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) // nolint:forcetypeassert
|
|
}
|
|
|
|
// ReleaseDict release dict.
|
|
func ReleaseDict(d *Dict) {
|
|
d.Reset()
|
|
defaultPool.Put(d)
|
|
}
|