2 Star 1 Fork 2

EpitomeMed / BaseFramework

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 446 Bytes
一键复制 编辑 原始数据 按行查看 历史
Ubuntu 提交于 2026-03-07 21:13 +08:00 . 调整Pool函数签名
package main
import (
"fmt"
"time"
objpool "gitee.com/mstes/base-framework/pool"
"github.com/google/uuid"
)
type Test struct {
ID string
}
func main() {
p := objpool.New(objpool.WithSetConfig(&objpool.PoolConfig[*Test]{
NewFunc: func() *Test {
fmt.Println("create obj")
return &Test{
ID: uuid.NewString(),
}
},
}))
for {
t := p.Get()
fmt.Println("id = ", t.ID)
p.Put(t)
time.Sleep(time.Millisecond * 10)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/mstes/base-framework.git
git@gitee.com:mstes/base-framework.git
mstes
base-framework
BaseFramework
v1.9.0

搜索帮助

⌂ 换网址