Class ObjectPool<T>
Simple policy based pool for objects.
Inherited Members
Namespace:CacheManager.Core.Utility
Assembly:CacheManager.Core.dll
Syntax
public class ObjectPool<T>
where T : class
Type Parameters
Name | Description |
---|---|
T | The object type to pool. |
Constructors
| Improve this Doc View SourceObjectPool(IObjectPoolPolicy<T>, Nullable<Int32>)
Initializes a new instance of the ObjectPool<T> class.
Declaration
public ObjectPool(IObjectPoolPolicy<T> policy, int ? maxItems = null)
Parameters
Type | Name | Description |
---|---|---|
IObjectPoolPolicy<T> | policy | The object pool policy. |
Nullable<Int32> | maxItems | Number of items to keep, defaults to number of processors * 2. |
Methods
| Improve this Doc View SourceLease()
Returns either a pooled or new instance of T.
Declaration
public T Lease()
Returns
Type | Description |
---|---|
T | The pooled or new instance. |
Return(T)
Returns the instance to the pool (if possible).
Declaration
public void Return(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The instance to return to the pool. |