import pool "github.com/deweppro/go-chan-pool"
type Object struct {
I int64
}
func main() {
cpool := &pool.ChanPool{
Size: 1, // pool size
New: func() interface{} { // handler for creating a new object in pool
return &Object{}
},
}
a := cpool.Get().(*Object) //get object from pool
cpool.Put(a) //set object to pool
}
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
go chan pool
License
deweppro/go-chan-pool
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|