TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

interface IResourceCache in Tinman.AddOns.Rendering

interface IResourceCache extends IDisposable
  base of ResourceCache

Attributes

LifecycleState

Returns the lifecycle state of this object.

property LifecycleState { get }
type LifecycleState
value The lifecycle state.
inherited ILifecycleState.LifecycleState

Methods

AcquireTry

Acquires a strong reference to this disposable object.

[OwnerReturn, ThreadSafe]
method AcquireTry ()
type IDisposable
returns this if a new strong reference has been acquired, null if this object is already being disposed.
inherited IDisposable.AcquireTry

Remarks:

The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.

This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.

Clear

Evicts all cached resource objects.

method Clear ()

Dispose

Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.

[Dispose, OwnerThis, ThreadSafe]
method Dispose ()
inherited IDisposable.Dispose

Remarks:

The Dispose method silently returns if the object has already been disposed.

Evict

Evicts a cached resource object.

method Evict (IResourceHandle handle)
params handle The resource handle or null.

Remarks:

After this method has been called, the next call to Get or Own will create a new resource object. The evicted resource is not necessarily disposed, because this depends on the actual disposal strategy of the implementing class.

Get

Returns a cached resource object.

method Get (IResourceHandle handle, IResourceHandle preload = null)
type IResource
params handle The resource handle or null. If handle does not implement the IPreloadingResourceHandle interface or CanPreloadResource returns false, the preload parameter is ignored and this method behaves as if it were null.
  preload If null, the calling thread will be blocked until the handle resource has been loaded. Otherwise, the handle resource is preloaded in the background (if not null) and the cached resource object of preload is returned instead. Defaults to null.
returns The cached resource object or null if both handle and preload are null or it either one has returned a null resource object.

Remarks:

The returned resource object will be disposed automatically, usually when this IResourceCache object is disposed. However, implementing classes are free to choose other disposal strategies.

Own

Returns a cached resource object.

[OwnerReturn]
method Own (IResourceHandle handle)
type IResource
params handle The resource handle or null.
returns The cached resource object or null if handle is null.