part

package
v0.21.10 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 1 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buf added in v0.21.1

type Buf[T any] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New[T any](NewF func() *T, ValidF func(*T) (inUse bool), ReuseF func(*T) *T, PoolF func(*T) *T, maxsize int) *Buf[T]

创建池

NewF: func() *T 新值

ValidF func(*T) (inUse bool) 是否可重用(是否还在使用)

ReuseF func(*T) *T 重用前处理

PoolF func(*T) *T 入池前处理

maxsize int 池最大数量

func (*Buf[T]) Get added in v0.21.1

func (t *Buf[T]) Get() *T

func (*Buf[T]) Put added in v0.21.1

func (t *Buf[T]) Put(item ...*T)

func (*Buf[T]) Trim added in v0.21.1

func (t *Buf[T]) Trim()

Jump to

Keyboard shortcuts

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