pooling

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 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 Pooler

type Pooler[T any] interface {
	Get() *T
	Clear()
	Size() int
}

func NewPool

func NewPool[T any](
	initFunction func() *T,
	opt *PoolingOptions,
) (Pooler[T], error)

NewPool creates a new pool of entities params:

  • initFunction: func() *T => function that returns a new entity<T>
  • opt: *PoolingOptions => options for the pool

returns:

  • Pooler<T>: pool of entities
  • error: error if any

type PoolingOptions

type PoolingOptions struct {
	PoolSize int
}

PoolingOptions is the options for the pool params:

  • PoolSize: int => size of the pool

Jump to

Keyboard shortcuts

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