Class PrewarmAssetsByLabelsTask
Initialization task for prewarming assets by labels (Unity/Addressables agnostic). Resolves asset keys from labels and schedules them for prefetching.
Implements
Inherited Members
Namespace: Serenity.AssetPrefetcher.Application.Tasks
Assembly: Serenity.AssetPrefetcher.Application.dll
Syntax
public class PrewarmAssetsByLabelsTask : ITask
Constructors
PrewarmAssetsByLabelsTask(IAssetPrefetcherService, IAssetKeyCatalog, string, IEnumerable<string>, string, TaskCriticality, float)
Initializes a new prewarm task for the specified labels and context.
Declaration
public PrewarmAssetsByLabelsTask(IAssetPrefetcherService prefetcher, IAssetKeyCatalog catalog, string contextId, IEnumerable<string> labels, string id, TaskCriticality criticality, float weight)
Parameters
| Type | Name | Description |
|---|---|---|
| IAssetPrefetcherService | prefetcher | The asset prefetcher service to use |
| IAssetKeyCatalog | catalog | The asset key catalog for label resolution |
| string | contextId | The context identifier for the prewarmed assets |
| IEnumerable<string> | labels | Collection of labels to resolve and prewarm |
| string | id | Unique identifier for this task |
| TaskCriticality | criticality | Criticality level of this initialization task |
| float | weight | Weight factor for task scheduling |
Properties
Criticality
Declaration
public TaskCriticality Criticality { get; }
Property Value
| Type | Description |
|---|---|
| TaskCriticality | The criticality level of this initialization task. |
Id
Declaration
public string Id { get; }
Property Value
| Type | Description |
|---|---|
| string | The unique identifier for this task. |
LastError
Declaration
public Exception LastError { get; }
Property Value
| Type | Description |
|---|---|
| Exception | The last error encountered during task execution. |
LastResolvedKeys
Declaration
public HashSet<string> LastResolvedKeys { get; }
Property Value
| Type | Description |
|---|---|
| HashSet<string> | The last resolved keys for telemetry/debugging purposes. |
Weight
Declaration
public float Weight { get; }
Property Value
| Type | Description |
|---|---|
| float | The weight factor for task scheduling. |
Methods
RunAsync(CancellationToken)
Executes the prewarm task by resolving asset keys from labels and scheduling prefetch operations.
Declaration
public Task RunAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Cancellation token for the async operation |
Returns
| Type | Description |
|---|---|
| Task | Task representing the async prewarming operation |