API ReferenceSandbox.Resources
ResourceGenerator<T>class
A resource generator targetting a specific type
Constructors1
Showing 1 constructors
protected ResourceGenerator<T>()
No results match this filter.
Methods8
Showing 8 methods
public void AddToCache(T val)
| Parameter | Type | Description |
|---|---|---|
| val | T | — |
Returns:
void—public virtual T Create(Sandbox.Resources.ResourceGenerator.Options options)
Create the resource blocking
| Parameter | Type | Description |
|---|---|---|
| options | Options | — |
Returns:
T—public virtual System.Threading.Tasks.ValueTask`1<T> CreateAsync(Sandbox.Resources.ResourceGenerator.Options options, System.Threading.CancellationToken token)
Create the resource asyncronously
| Parameter | Type | Description |
|---|---|---|
| options | Options | — |
| token | CancellationToken | — |
Returns:
ValueTask<T>—public virtual T FindCached()
Find a previously created of this resource
Returns:
T—public virtual T FindOrCreate(Sandbox.Resources.ResourceGenerator.Options options)
If we generated this before, then find the current cache'd value. If not, then generate a new one.
| Parameter | Type | Description |
|---|---|---|
| options | Options | — |
Returns:
T—public virtual System.Threading.Tasks.ValueTask`1<T> FindOrCreateAsync(Sandbox.Resources.ResourceGenerator.Options options, System.Threading.CancellationToken token)
If we generated this before, then find the current cache'd value. If not, then generate a new one.
| Parameter | Type | Description |
|---|---|---|
| options | Options | — |
| token | CancellationToken | — |
Returns:
ValueTask<T>—public virtual Sandbox.Resource FindOrCreateObject(Sandbox.Resources.ResourceGenerator.Options options)
| Parameter | Type | Description |
|---|---|---|
| options | Options | — |
public virtual System.Threading.Tasks.ValueTask`1<Sandbox.Resource> FindOrCreateObjectAsync(Sandbox.Resources.ResourceGenerator.Options options, System.Threading.CancellationToken token)
| Parameter | Type | Description |
|---|---|---|
| options | Options | — |
| token | CancellationToken | — |
No results match this filter.
Properties1
Showing 1 properties
public virtual bool Sandbox.Resources.ResourceGenerator<T>.UseMemoryCache { get; set; }
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—No results match this filter.