pool

package
v0.0.0-...-bd43069 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsPool

type MetricsPool struct {
	P sync.Pool
	// contains filtered or unexported fields
}

MetricsPool is a sync.Pool that records the number of gets and puts

func (*MetricsPool) Get

func (p *MetricsPool) Get() interface{}

Get selects an arbitrary item from the Pool, removes it from the Pool, and returns it to the caller. Get may choose to ignore the pool and treat it as empty. Callers should not assume any relation between values passed to Put and the values returned by Get.

If Get would otherwise return nil and p.New is non-nil, Get returns the result of calling p.New.

func (*MetricsPool) Put

func (p *MetricsPool) Put(x interface{})

Put adds x to the pool

func (*MetricsPool) Releases

func (p *MetricsPool) Releases() int32

Releases returns the current # of items requested from the pool, but not returned.

This is mainly for detecting leaks

Jump to

Keyboard shortcuts

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