pool

package
v0.0.0-...-b5dcede Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferPool

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

BufferPool is a bucketed pool for variably bytes buffers.

func NewBuffer

func NewBuffer(minSize, maxSize int, factor float64) *BufferPool

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

func (*BufferPool) Get

func (p *BufferPool) Get(sz int) *bytes.Buffer

Get returns a byte buffer that fits the given size.

func (*BufferPool) Put

func (p *BufferPool) Put(s *bytes.Buffer)

Put adds a byte buffer to the right bucket in the pool.

Jump to

Keyboard shortcuts

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