ObjectCache<T> Class
A simple object recycling system.
public abstract class ObjectCache<T> where T : classType parameters
T- Type of the object to cache
Constructors
| Name | Description |
|---|---|
| ObjectCache() | Initializes a new instance of the ObjectCache<T> class. |
ObjectCache()
ObjectCache.csInitializes a new instance of the ObjectCache<T> class.
protected ObjectCache()Methods
| Name | Description |
|---|---|
| Clear() | Clears this cache. |
| Get() | Gets a new instance. |
| NewInstance() | Creates a new instance of {T} |
| Release(T) | Releases the specified instance. |
| Reset(T) | Resets the specified instance when ObjectCache<T>.Release is called before storing back to this cache. |
Clear()
ObjectCache.csClears this cache.
public void Clear()Get()
ObjectCache.csGets a new instance.
public T Get()Returns
T
NewInstance()
Creates a new instance of {T}
protected abstract T NewInstance()Returns
T A new instance of {T}
Release(T)
ObjectCache.csReleases the specified instance.
public void Release(T instance)Reset(T)
Resets the specified instance when ObjectCache<T>.Release is called before storing back to this cache.
protected abstract void Reset(T instance)Parameters
instanceT- The instance.