API ReferenceSandbox.Resources

ResourceGenerator<T>class

A resource generator targetting a specific type

objectResourceGeneratorResourceGenerator<T>
Namespace
Sandbox.Resources
Assembly
Sandbox.Engine
Declaration
public abstract class Sandbox.Resources.ResourceGenerator<T> : Sandbox.Resources.ResourceGenerator

Constructors1

Showing 1 constructors

Methods8

Showing 8 methods

public void AddToCache(T val)PUBLIC

ParameterTypeDescription
valT
Returns:void

public virtual T Create(Sandbox.Resources.ResourceGenerator.Options options)PUBLICVIRTUAL

Create the resource blocking

ParameterTypeDescription
optionsOptions
Returns:T

public virtual System.Threading.Tasks.ValueTask`1<T> CreateAsync(Sandbox.Resources.ResourceGenerator.Options options, System.Threading.CancellationToken token)PUBLICVIRTUAL

Create the resource asyncronously

ParameterTypeDescription
optionsOptions
tokenCancellationToken
Returns:ValueTask<T>

public virtual T FindCached()PUBLICVIRTUAL

Find a previously created of this resource

Returns:T

public virtual T FindOrCreate(Sandbox.Resources.ResourceGenerator.Options options)PUBLICVIRTUAL

If we generated this before, then find the current cache'd value. If not, then generate a new one.

ParameterTypeDescription
optionsOptions
Returns:T

public virtual System.Threading.Tasks.ValueTask`1<T> FindOrCreateAsync(Sandbox.Resources.ResourceGenerator.Options options, System.Threading.CancellationToken token)PUBLICVIRTUAL

If we generated this before, then find the current cache'd value. If not, then generate a new one.

ParameterTypeDescription
optionsOptions
tokenCancellationToken
Returns:ValueTask<T>

public virtual System.Threading.Tasks.ValueTask`1<Sandbox.Resource> FindOrCreateObjectAsync(Sandbox.Resources.ResourceGenerator.Options options, System.Threading.CancellationToken token)PUBLICVIRTUAL

ParameterTypeDescription
optionsOptions
tokenCancellationToken
Returns:ValueTask<Resource>

Properties1

Showing 1 properties

public virtual bool Sandbox.Resources.ResourceGenerator<T>.UseMemoryCache { get; set; }PUBLICVIRTUALGETSET

If true then the generation will avoid creating duplicate resources by checking hash codes of previously generated resources and re-using them if possible.

Returns:bool

On this page