Skip to content

ObjectPool

Hyomoto edited this page Jun 24, 2021 · 2 revisions
Jump To Go Back Arguments Methods Variables

ObjectPool( new )

Holds a pool of objects that can be reused.

Arguments

Name Type Purpose
new method A method that returns a new object for this pool.

Methods

Jump To top put get size is_empty free destroy

put( value )

Returns: mixed

Name Type Purpose
value mixed An object

Puts an object into the pool and returns it.


get( )

Returns: mixed

Name Type Purpose
None

Returns an object from the pool if it exists. Otherwise a new object is returned.


size( )

Returns: int

Name Type Purpose
None

Returns the number of objects in the pool


is_empty( )

Returns: bool

Name Type Purpose
None

Returns true if the pool is empty.


free( func )

Returns: self

Name Type Purpose
func method A function

Frees the objects in the pool. If func is provided, each item will be passed into the function.


destroy( func )

Returns: self

Name Type Purpose
func method A function

Destroys the internal stack. If func is provided, each item will be passed into the function.


Variables

Jump To top
Name Type Initial Purpose
__New undef _new == undefined ? function() { return {} } : _new No description.
__Pool undef ds_stack_create() No description.
Clone this wiki locally