pool

package
v2.0.0-beta.5+incompat... Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2017 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 BytesPool

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

BytesPool is a bucketed pool for variably sized byte slices.

func NewBytesPool

func NewBytesPool(minSize, maxSize int, factor float64) *BytesPool

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

func (*BytesPool) Get

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

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

func (*BytesPool) Put

func (p *BytesPool) Put(b []byte)

Put returns a byte slice 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