pool

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReferenceCountable

type ReferenceCountable interface {
	SetInstance(i interface{})
	IncrementReferenceCount()
	DecrementReferenceCount()
}

ReferenceCountable ...

type ReferenceCountedPool

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

ReferenceCountedPool Struct representing the pool

func NewReferenceCountedPool

func NewReferenceCountedPool(factory func(referenceCounter ReferenceCounter) ReferenceCountable, reset func(interface{}) error) *ReferenceCountedPool

NewReferenceCountedPool Method to create a new pool

func (*ReferenceCountedPool) Get

Get Method to get new object

func (*ReferenceCountedPool) Stats

func (p *ReferenceCountedPool) Stats() map[string]interface{}

Stats Method to return reference counted pool stats

type ReferenceCounter

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

ReferenceCounter ...

func (ReferenceCounter) DecrementReferenceCount

func (r ReferenceCounter) DecrementReferenceCount()

DecrementReferenceCount Method to decrement a reference If the reference count goes to zero, the object is put back inside the pool

func (ReferenceCounter) IncrementReferenceCount

func (r ReferenceCounter) IncrementReferenceCount()

IncrementReferenceCount Method to increment a reference

func (*ReferenceCounter) SetInstance

func (r *ReferenceCounter) SetInstance(i interface{})

SetInstance Method to set the current instance

Jump to

Keyboard shortcuts

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