ObjectPool

Description

sealed class Tinman.Core.System.ObjectPool
<TObject ref : IMemoryConsumption>
<TKind val : IEquatable<TKind>>

Derived from

Disposable abstract
IObjectPoolThreadSafe<TObject, TKind>
IObjectPool<TObject, TKind>

A disposable and thread-safe pool for objects of different kinds, with configurable limits for object count and memory consumption.

See also

ObjectPoolUtil

Public / Constructors

Object­Pool


public constructor ObjectPool → (6)

name in : string

[not-empty]
The name of this object pool.

factory in : IObjectPoolFactory<TObject, TKind>

[not-null]
The pool object factory to use.

maximumCount opt : int32 = 0

[>=0]
Maximum number of pooled objects to hold. Set to 0 to disable.

maximumMemory opt : int64 = 0

[>=0]
Maximum memory to hold with pooled objects (estimated). Set to 0 to disable.

maximumAge opt : int32 = 0

[>=0]
Maximum age of pooled objects, in seconds. Set to 0 to disable.

monitor opt : Monitor own = null

The monitor object to use for synchronization or null to use a private instance.

Creates a new instance of ObjectPool.

Public / Attributes

Limit­Age


public attribute LimitAge → (get,set)

value : int32

[>=0]
The limit in seconds or 0 if unlimited.

The limit for the maximum age of pooled objects.

Limit­Count


public attribute LimitCount → (get,set)

value : int32

[>=0]
The limit or 0 if unlimited.

The limit for the maximum number of objects that may be present in the pool.

Limit­Memory


public attribute LimitMemory → (get,set)

value : int64

[>=0]
The limit in bytes or 0 if unlimited.

The limit for the maximum amount of memory consumed by the objects in the pool.