【文件属性】:
文件名称:pool:Go Golang通用网络连接池
文件大小:11KB
文件格式:ZIP
更新时间:2021-05-04 20:29:21
golang pool hacktoberfest Go
水池
Golang通用网络连接池。
特征:
更通用,连接池中的连接类型为interface{} ,使其更通用
更具可配置性,该连接支持设置最大空闲时间,超时连接将被关闭并丢弃,从而避免了空闲时自动连接失败的问题
支持用户设置ping方法,用于检查连接的连通性,无效的连接将被丢弃
支持连接等待,当连接池已满时,支持连接等待(如go db连接池)
基本用法:
//factory Specify the method to create the connection
factory := func () ( interface {}, error ) { return net . Dial ( "tcp" , "127.0.0.1:4000" ) }
//close Specify the method to close the connection
close := func ( v in
【文件预览】:
pool-master
----pool.go(271B)
----go.mod(86B)
----.github()
--------FUNDING.yml(682B)
----go.sum(1KB)
----channel.go(5KB)
----channel_rpc_test.go(5KB)
----.travis.yml(257B)
----example()
--------main.go(2KB)
----LICENSE(1KB)
----README.md(2KB)
----README_ZH_CN.md(2KB)
----.gitignore(272B)