pool

package
v2.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2018 License: Apache-2.0 Imports: 3 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) interface{}) *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) interface{}

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

func (*Pool) Put

func (p *Pool) Put(s interface{})

Put adds a 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