pool

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: LGPL-2.1 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T any](name string) *T

func ManagedGet

func ManagedGet[T any](managed ManagedPoolObject, pool *Pool) *T

func Put

func Put[T any](name string, obj *T)

Types

type Info

type Info struct {
	Name       string `json:"name"`
	TotalAlloc int64  `json:"total_alloc"`
	TotalGet   int64  `json:"total_get"`
	TotalPut   int64  `json:"total_put"`
}

func Stat

func Stat() []Info

type ManagedPoolObject

type ManagedPoolObject interface {
	ManagedPoolObject(po PoolObject)
}

type Pool

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

func Declare

func Declare[T any]() *Pool

func NewPool

func NewPool[T any]() *Pool

func (*Pool) Get

func (p *Pool) Get() any

func (*Pool) Name

func (p *Pool) Name() string

func (*Pool) Put

func (p *Pool) Put(obj any)

func (*Pool) TotalAlloc

func (p *Pool) TotalAlloc() int64

func (*Pool) TotalGet

func (p *Pool) TotalGet() int64

func (*Pool) TotalPut

func (p *Pool) TotalPut() int64

type PoolObject

type PoolObject struct {
	Pool   *Pool
	Object any
}

Jump to

Keyboard shortcuts

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