{"modulePath":"github.com/UnderTreeTech/waterdrop","version":"v1.3.8","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package xbuffer\n\n## Types\n\n```go\ntype BufferPool struct {\n\t// contains filtered or unexported fields\n}\n```\nBufferPool buffer pool definition\n\n```go\nfunc NewBufferPool(alloc int) *BufferPool\n```\nNewBufferPool creates a new BufferPool bounded to the given buffer size.\n\n```go\nfunc (bp *BufferPool) Get() *bytes.Buffer\n```\nGet gets a Buffer from the BufferPool\n\n```go\nfunc (bp *BufferPool) Put(buffer *bytes.Buffer)\n```\nPut returns the given Buffer to the BufferPool\n\n```go\ntype SizedBufferPool struct {\n\t// contains filtered or unexported fields\n}\n```\nSizedBufferPool sized buffer pool definition\n\n```go\nfunc NewSizedBufferPool(size int, alloc int) (bp *SizedBufferPool)\n```\nSizedBufferPool creates a new BufferPool bounded to the given size. size defines the number of buffers to be retained in the pool and alloc sets the initial capacity of new buffers to minimize calls to make().\n\nThe value of alloc should seek to provide a buffer that is representative of most data written to the the buffer (i.e. 95th percentile) without being overly large (which will increase static memory consumption).\n\n```go\nfunc (bp *SizedBufferPool) Get() (b *bytes.Buffer)\n```\nGet gets a Buffer from the SizedBufferPool, or creates a new one if none are available in the pool. Buffers have a pre-allocated capacity.\n\n```go\nfunc (bp *SizedBufferPool) Put(b *bytes.Buffer)\n```\nPut returns the given Buffer to the SizedBufferPool.\n\n","path":"github.com/UnderTreeTech/waterdrop/pkg/utils/xbuffer","name":"xbuffer","synopsis":"","isRedistributable":true}
