pool

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteSlicesPool

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

ByteSlicesPool is a pool for byte-slices reuse.

func NewByteSlicesPool

func NewByteSlicesPool(initialCap int) *ByteSlicesPool

NewByteSlicesPool create a new ByteSlicesPool instance. initialCap defines the cap value of new []byte.

func (*ByteSlicesPool) Get

func (p *ByteSlicesPool) Get() *[]byte

Get a []byte with 0 length and unfixed cap.

func (*ByteSlicesPool) GetWithLen

func (p *ByteSlicesPool) GetWithLen(l int) *[]byte

GetWithLen return a []byte with the designated length and unfixed cap.

func (*ByteSlicesPool) Put

func (p *ByteSlicesPool) Put(n *[]byte)

Put a []byte into pool. The slice will be reset to 0 length and its cap will not change.

Jump to

Keyboard shortcuts

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