...

Package buffpool

import "github.com/Diarkis/diarkis/buffpool"
Overview
Index

Overview ▾

type BuffPool

BuffPool buffer pool struct

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

func New

func New(name string, length int) *BuffPool

New creates a new buffer pool with a name. All buffers will have the same length as given

func (*BuffPool) Get

func (bp *BuffPool) Get() []byte

Get returns a buffer from the pool

func (*BuffPool) Put

func (bp *BuffPool) Put(buf []byte)

Put puts the buffer back into the pool. If the length of the buffer is not the same as initially given, the buffer will be ignored