PeanutButter
Loading...
Searching...
No Matches
PeanutButter.Utils.IPool< T > Interface Template Reference

Describes a pooling service for the underlying type T. More...

Inheritance diagram for PeanutButter.Utils.IPool< T >:
PeanutButter.SimpleHTTPServer.IHttpServerFactory PeanutButter.TempRedis.ITempRedisFactory PeanutButter.Utils.Pool< T > PeanutButter.SimpleHTTPServer.HttpServerFactory PeanutButter.TempRedis.TempRedisFactory PeanutButter.SimpleHTTPServer.HttpServerFactory PeanutButter.TempRedis.TempRedisFactory

Public Member Functions

IPoolItem< T > Take ()
 Attempt to take an item from the pool. If possible and required, an item will be created for you. If the pool is full and no item can be made available, this will a pool item with a null instance.
IPoolItem< T > Take (int maxWaitMilliseconds)
 Attempt to take an item from the pool, with a max wait in ms when the pool is already full and you need to wait on something else to release an instance. If no instance can be found in time, then this will return a PoolItem with a default instance.
IPoolItem< T > Borrow ()
 Attempt to take an item from the pool. If possible and required, an item will be created for you. If the pool is full and no item can be made available, this will a pool item with a null instance.
IPoolItem< T > Borrow (int maxWaitMilliseconds)
 Attempt to take an item from the pool, with a max wait in ms when the pool is already full and you need to wait on something else to release an instance. If no instance can be found in time, then this will return a PoolItem with a default instance.
void Forget (IPoolItem< T > item)
 Forget the item from the pool.
void Dispose ()
 Disposes of this pool and all items in the pool.

Properties

int MaxItems [get]
 The maximum number of items to hold in the pool.
int Count [get]
 How many items are currently in the pool.

Detailed Description

Describes a pooling service for the underlying type T.

Template Parameters
T

Member Function Documentation

◆ Borrow() [1/2]

IPoolItem< T > PeanutButter.Utils.IPool< T >.Borrow ( )

Attempt to take an item from the pool. If possible and required, an item will be created for you. If the pool is full and no item can be made available, this will a pool item with a null instance.

Returns

Implemented in PeanutButter.Utils.Pool< T >.

◆ Borrow() [2/2]

IPoolItem< T > PeanutButter.Utils.IPool< T >.Borrow ( int maxWaitMilliseconds)

Attempt to take an item from the pool, with a max wait in ms when the pool is already full and you need to wait on something else to release an instance. If no instance can be found in time, then this will return a PoolItem with a default instance.

Parameters
maxWaitMilliseconds
Returns

Implemented in PeanutButter.Utils.Pool< T >.

◆ Dispose()

void PeanutButter.Utils.IPool< T >.Dispose ( )

Disposes of this pool and all items in the pool.

Implemented in PeanutButter.Utils.Pool< T >.

◆ Forget()

void PeanutButter.Utils.IPool< T >.Forget ( IPoolItem< T > item)

Forget the item from the pool.

Parameters
item

Implemented in PeanutButter.Utils.Pool< T >.

◆ Take() [1/2]

IPoolItem< T > PeanutButter.Utils.IPool< T >.Take ( )

Attempt to take an item from the pool. If possible and required, an item will be created for you. If the pool is full and no item can be made available, this will a pool item with a null instance.

Returns

Implemented in PeanutButter.Utils.Pool< T >.

◆ Take() [2/2]

IPoolItem< T > PeanutButter.Utils.IPool< T >.Take ( int maxWaitMilliseconds)

Attempt to take an item from the pool, with a max wait in ms when the pool is already full and you need to wait on something else to release an instance. If no instance can be found in time, then this will return a PoolItem with a default instance.

Parameters
maxWaitMilliseconds
Returns

Implemented in PeanutButter.Utils.Pool< T >.

Property Documentation

◆ Count

int PeanutButter.Utils.IPool< T >.Count
get

How many items are currently in the pool.

Implemented in PeanutButter.Utils.Pool< T >.

◆ MaxItems

int PeanutButter.Utils.IPool< T >.MaxItems
get

The maximum number of items to hold in the pool.

Implemented in PeanutButter.Utils.Pool< T >.


The documentation for this interface was generated from the following file:
  • source/Utils/PeanutButter.Utils/Pool.cs