Co-authored-by: andrey1s <andrey@4devs.pro> Reviewed-on: #6 Co-authored-by: andrey <andrey@4devs.io> Co-committed-by: andrey <andrey@4devs.io>
23 lines
259 B
Go
23 lines
259 B
Go
package entry
|
|
|
|
import "sync"
|
|
|
|
//nolint:gochecknoglobals
|
|
var pool = sync.Pool{
|
|
New: func() interface{} {
|
|
return New()
|
|
},
|
|
}
|
|
|
|
//nolint:forcetypeassert
|
|
func Get() *Entry {
|
|
e := pool.Get().(*Entry)
|
|
e.Reset()
|
|
|
|
return e
|
|
}
|
|
|
|
func Put(e *Entry) {
|
|
pool.Put(e)
|
|
}
|