buf

package
v0.0.0-...-020888f Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderBufferPoolSize = 8192
)

Variables

View Source
var (
	Buffers = NewBufferPool()
)
View Source
var BuffersRateLimit = rate.NewLimiter(rate.Limit(4096), 16)

Functions

func NewTinyBufferPool

func NewTinyBufferPool() *sync.Pool

Types

type BufferPool

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

BufferPool defines the struct of a buffered pool with 4 objects.

func NewBufferPool

func NewBufferPool() (bufferP *BufferPool)

NewBufferPool returns a new buffered pool.

func (*BufferPool) Get

func (bufferP *BufferPool) Get(size int) (data []byte, err error)

Get returns the data based on the given size. Different size corresponds to different object in the pool.

func (*BufferPool) Put

func (bufferP *BufferPool) Put(data []byte)

Put puts the given data into the buffer pool.

Jump to

Keyboard shortcuts

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