Api Sandbox Resources ResourceGenerator<T>
class

ResourceGenerator<T>

public abstract class ResourceGenerator<T> : ResourceGenerator

A resource generator targetting a specific type

Properties

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

Methods

virtual T FindCached()

Find a previously created of this resource

Void AddToCache(T val)
virtual T FindOrCreate(Options options)

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

virtual ValueTask<Resource> FindOrCreateObjectAsync(Options options, CancellationToken token)
virtual Resource FindOrCreateObject(Options options)
virtual ValueTask<T> FindOrCreateAsync(Options options, CancellationToken token)

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

virtual T Create(Options options)

Create the resource blocking

virtual ValueTask<T> CreateAsync(Options options, CancellationToken token)

Create the resource asyncronously

Assembly: Sandbox.Engine Namespace: Sandbox.Resources Full Name: Sandbox.Resources.ResourceGenerator<T>