pool

package
v1.84.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

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

Pool is a bucketed pool for variably sized byte slices.

func New

func New(minSize, maxSize int, factor float64, makeFunc func(int) []byte) *Pool

New returns a new Pool with size buckets for minSize to maxSize increasing by the given factor.

func (*Pool) Get

func (p *Pool) Get(sz int) []byte

Get returns a new byte slices that fits the given size.

func (*Pool) Put

func (p *Pool) Put(s []byte)

Put adds a slice to the right bucket in the pool. This method has been adjusted from its initial implementation to ignore byte slices that dont have the correct size

Jump to

Keyboard shortcuts

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