tcache

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferPool

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

BufferPool is a 'buffer pool'.

func NewBufferPool

func NewBufferPool(baseline int) *BufferPool

NewBufferPool creates a new initialized 'buffer pool'.

func (*BufferPool) Get

func (p *BufferPool) Get(n int) []byte

Get returns buffer with length of n.

func (*BufferPool) Put

func (p *BufferPool) Put(b []byte)

Put adds given buffer to the pool.

func (*BufferPool) String

func (p *BufferPool) String() string

type ChanBuffer

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

ChanBuffer 基于channel实现的缓冲区

func NewChanBuffer

func NewChanBuffer[T any](fetcher ttypes.FetchHandler[T], resultLen int, timeout time.Duration) *ChanBuffer[T]

func (*ChanBuffer[T]) Close

func (c *ChanBuffer[T]) Close()

func (*ChanBuffer[T]) Get

func (c *ChanBuffer[T]) Get() (T, error)

type IBufferPool

type IBufferPool interface {
	Get(n int) []byte
	Put(b []byte)
}

type ICacheBuffer

type ICacheBuffer[T any] interface {
	Close()
	Get() (T, error)
}

func NewCacheBuffer

func NewCacheBuffer[T any](fetcher ttypes.FetchHandler[T]) ICacheBuffer[T]

Jump to

Keyboard shortcuts

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