objectpool

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 2 Imported by: 0

Documentation

Overview

Package objectpool provides object pool.

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 represents the buffer object pool.

func NewBufferPool

func NewBufferPool() *BufferPool

NewBufferPool creates a new bytes.Buffer object pool.

func (*BufferPool) Get

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

Get takes the buffer from the pool.

func (*BufferPool) Put

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

Put puts buffer back into the pool.

type BytesPool

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

BytesPool represents the bytes array object pool.

func NewBytesPool

func NewBytesPool(size int) *BytesPool

NewBytesPool creates a new bytes array object pool.

func (*BytesPool) Get

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

Get takes the bytes array from the object pool.

func (*BytesPool) Put

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

Put puts bytes array back into object pool.

Jump to

Keyboard shortcuts

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