pool

package
v0.0.0-...-b12e7ef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

* @Author: drowningwhale 351231768@qq.com * @Date: 2023-10-09 16:45:31 * @LastEditors: drowningwhale 351231768@qq.com * @LastEditTime: 2023-10-09 17:41:15 * @FilePath: \go-course\Pool\NewPool.go * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNewPool

func NewNewPool(initCnt, maxCnt, maxIdleCnt int, maxIdleTime time.Duration, factory func() (net.Conn, error)) (*newPool, error)

Types

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool(initCnt, maxIdleCnt, maxCnt int, maxIdleTime time.Duration, factory func() (net.Conn, error)) (*Pool, error)

func (*Pool) Close

func (p *Pool) Close()

func (*Pool) Get

func (p *Pool) Get(ctx context.Context) (net.Conn, error)

实现取连接

func (*Pool) Put

func (p *Pool) Put(ctx context.Context, conn net.Conn) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL