Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

UniRx.Toolkit

neuecc edited this page Jul 26, 2016 · 1 revision

AsyncObjectPool<T>

Bass class of ObjectPool. If needs asynchronous initialization, use this instead of standard ObjectPool.

public abstract class UniRx.Toolkit.AsyncObjectPool<T>
    : IDisposable

Properties

Type Name Summary
Int32 Count Current pooled object count.
Int32 MaxPoolCount Limit of instace count.

Methods

Type Name Summary
void Clear(Boolean callOnBeforeRent = False) Clear pool.
IObservable<T> CreateInstanceAsync() Create instance when needed.
void Dispose(Boolean disposing)
void Dispose()
void OnBeforeRent(T instance) Called before return to pool, useful for set active object(it is default behavior).
void OnBeforeReturn(T instance) Called before return to pool, useful for set inactive object(it is default behavior).
void OnClear(T instance) Called when clear or disposed, useful for destroy instance or other finalize method.
IObservable<Unit> PreloadAsync(Int32 preloadCount, Int32 threshold) Fill pool before rent operation.
IObservable<T> RentAsync() Get instance from pool.
void Return(T instance) Return instance to pool.
void Shrink(Single instanceCountRatio, Int32 minSize, Boolean callOnBeforeRent = False) Trim pool instances.
IDisposable StartShrinkTimer(TimeSpan checkInterval, Single instanceCountRatio, Int32 minSize, Boolean callOnBeforeRent = False) If needs shrink pool frequently, start check timer.

ObjectPool<T>

Bass class of ObjectPool.

public abstract class UniRx.Toolkit.ObjectPool<T>
    : IDisposable

Properties

Type Name Summary
Int32 Count Current pooled object count.
Int32 MaxPoolCount Limit of instace count.

Methods

Type Name Summary
void Clear(Boolean callOnBeforeRent = False) Clear pool.
T CreateInstance() Create instance when needed.
void Dispose(Boolean disposing)
void Dispose()
void OnBeforeRent(T instance) Called before return to pool, useful for set active object(it is default behavior).
void OnBeforeReturn(T instance) Called before return to pool, useful for set inactive object(it is default behavior).
void OnClear(T instance) Called when clear or disposed, useful for destroy instance or other finalize method.
IObservable<Unit> PreloadAsync(Int32 preloadCount, Int32 threshold) Fill pool before rent operation.
T Rent() Get instance from pool.
void Return(T instance) Return instance to pool.
void Shrink(Single instanceCountRatio, Int32 minSize, Boolean callOnBeforeRent = False) Trim pool instances.
IDisposable StartShrinkTimer(TimeSpan checkInterval, Single instanceCountRatio, Int32 minSize, Boolean callOnBeforeRent = False) If needs shrink pool frequently, start check timer.