pool

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package pool provides wrappers over sync.Pool to be used in Holyheld applications

Index

Constants

View Source
const Unsized = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferPool

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

func NewBufferPool

func NewBufferPool(defaultSize int64) *BufferPool

NewBufferPool creates a new buffer pool with the given default size. If defaultSize is 0, the pool will create a new empty buffer for each Pool.New call Else, the pool will create a new buffer with the given cap for each Pool.New call

Panics if defaultSize is negative.

func (*BufferPool) Get

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

Get returns a buffer from the pool.

func (*BufferPool) Put

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

Put resets the buffer and puts it back to the pool.

func (*BufferPool) Size

func (p *BufferPool) Size() int64

type Pool

type Pool[T any] struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool[T any](newFn func() T) *Pool[T]

func (*Pool[T]) Get

func (p *Pool[T]) Get() T

func (*Pool[T]) Put

func (p *Pool[T]) Put(v T)

Jump to

Keyboard shortcuts

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