Skip to content

AssetLoader.GetOrLoadCoreAsync(RefCountKey, Func>, CancellationToken) Method

Definition

Namespace: Brine2D.Assets

Tracks the key on both this scope and the shared cache, executes the load, and rolls back both ref counts if the load faults or the caller's token is cancelled. When cancellation wins the race against a completing load, the asset may remain in the cache with no live ref count until the next load of the same key or Brine2D.Assets.AssetCache.DisposeAsync.

private System.Threading.Tasks.Task<T> GetOrLoadCoreAsync<T>(Brine2D.Assets.RefCountKey key, System.Func<System.Threading.CancellationToken,System.Threading.Tasks.Task<T>> loadFromCache, System.Threading.CancellationToken cancellationToken);

Type parameters

T

Parameters

key RefCountKey

loadFromCache System.Func<System.Threading.CancellationToken,System.Threading.Tasks.Task<T>>

cancellationToken System.Threading.CancellationToken

Returns

System.Threading.Tasks.Task<T>