AMPS C# Client  5.3.3.4
AMPS C# Client for .NET
AMPS.Client.Pool< T > Class Template Reference

Public Member Functions

 Pool (int initialSize)
 
get ()
 
void returnToPool (T theInstance)
 

Detailed Description

A simple generic instance pool for objects that take a while to construct.

Parameters
<T>The pooled type.
Type Constraints
T :new() 

Constructor & Destructor Documentation

◆ Pool()

AMPS.Client.Pool< T >.Pool ( int  initialSize)
inline

Constructs a pool with the given size

Parameters
theClassThe Class pooled. Should always be T.class. Sorry we can't do this ourselves.
initialSizeThe initial size of the pool. If you pass a value less than 1, we'll just use 1.

Member Function Documentation

◆ get()

T AMPS.Client.Pool< T >.get ( )
inline

Returns an object from the pool, growing self if necessary (by initialSize). If T cannot be instantiated, returns null.

Returns
A pooled instance.

◆ returnToPool()

void AMPS.Client.Pool< T >.returnToPool ( theInstance)
inline

Return an object to the pool. Note, you're responsible for clear/reset of objects being returned.

Parameters
theInstanceThe T to return to the pool.

The documentation for this class was generated from the following file: