Documentation
¶
Overview ¶
Package buffer provides pool of custom byte buffers.
It is just ByteBuffer extracted from github.com/valyala/fasthttp.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Buffer ¶
type Buffer struct { // B is a byte buffer to use in append-like workloads. // See example code for details. B []byte }
Buffer provides byte buffer, which can be used in order to minimize memory allocations.
ByteBuffer may be used with functions appending data to the given []byte slice. See example code for details.
Use AcquireByteBuffer for obtaining an empty byte buffer.
func Acquire ¶
func Acquire() *Buffer
Acquire returns an empty byte buffer from the pool.
Acquired byte buffer may be returned to the pool via Release call. This reduces the number of memory allocations required for byte buffer management.
type Pool ¶
type Pool struct { Size int // contains filtered or unexported fields }
Pool wraps sync.Pool for buffer management with different initial sizes. Empty value for Pool is usable.