DurableTaskClient.PurgeInstanceAsync(String, CancellationToken) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Purges orchestration instance metadata from the durable store.
public abstract System.Threading.Tasks.Task<Microsoft.DurableTask.Client.PurgeResult> PurgeInstanceAsync (string instanceId, System.Threading.CancellationToken cancellation = default);
abstract member PurgeInstanceAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.DurableTask.Client.PurgeResult>
Public MustOverride Function PurgeInstanceAsync (instanceId As String, Optional cancellation As CancellationToken = Nothing) As Task(Of PurgeResult)
Parameters
- instanceId
- String
The unique ID of the orchestration instance to purge.
- cancellation
- CancellationToken
A CancellationToken that can be used to cancel the purge operation.
Returns
This method returns a PurgeResult object after the operation has completed with a
PurgedInstanceCount value of 1
or 0
, depending on whether the target
instance was successfully purged.
Remarks
This method can be used to permanently delete orchestration metadata from the underlying storage provider, including any stored inputs, outputs, and orchestration history records. This is often useful for implementing data retention policies and for keeping storage costs minimal. Only orchestration instances in the Completed, Failed, or Terminated state can be purged.
If instanceId
is not found in the data store, or if the instance is found but not in a terminal state, then the returned PurgeResult object will have a PurgedInstanceCount value of 0
. Otherwise, the existing data will be purged and PurgedInstanceCount will be 1
.