<PackageReference Include="Polly" Version="5.1.1-v5-x-cachealpha0001" />

Policy<TResult>

public abstract class Policy<TResult>
Transient fault handling policies that can be applied to delegates returning results of type TResult
public string PolicyKey { get; }

A key intended to be unique to each Policy instance, which is passed with executions as the PolicyKey property.

public static PolicyBuilder<TResult> Handle<TException>() where TException : Exception

Specifies the type of exception that this policy can handle.

public static PolicyBuilder<TResult> Handle<TException>(Func<TException, bool> exceptionPredicate) where TException : Exception

Specifies the type of exception that this policy can handle with additional filters on this exception type.

public static PolicyBuilder<TResult> HandleResult(Func<TResult, bool> resultPredicate)

Specifies a filter on the return result values that this strongly-typed generic policy will handle.

public static PolicyBuilder<TResult> HandleResult(TResult result)

Specifies a return result value which the strongly-typed generic policy will handle.

public TResult Execute(Func<TResult> action)

Executes the specified action within the policy and returns the Result.

public TResult Execute(Func<TResult> action, IDictionary<string, object> contextData)

Executes the specified action within the policy and returns the result.

public TResult Execute(Func<TResult> action, Context context)

Executes the specified action within the policy and returns the result.

public TResult Execute(Func<Context, TResult> action, IDictionary<string, object> contextData)

Executes the specified action within the policy and returns the result.

public TResult Execute(Func<Context, TResult> action, Context context)

Executes the specified action within the policy and returns the result.

public TResult Execute(Func<CancellationToken, TResult> action, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the result.

public TResult Execute(Func<CancellationToken, TResult> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the result.

public TResult Execute(Func<CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the result.

public TResult Execute(Func<Context, CancellationToken, TResult> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the result.

public TResult Execute(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the result.

public PolicyResult<TResult> ExecuteAndCapture(Func<TResult> action)

Executes the specified action within the policy and returns the captured result

public PolicyResult<TResult> ExecuteAndCapture(Func<TResult> action, IDictionary<string, object> contextData)

Executes the specified action within the policy and returns the captured result.

public PolicyResult<TResult> ExecuteAndCapture(Func<TResult> action, Context context)

Executes the specified action within the policy and returns the captured result.

public PolicyResult<TResult> ExecuteAndCapture(Func<Context, TResult> action, IDictionary<string, object> contextData)

Executes the specified action within the policy and returns the captured result.

public PolicyResult<TResult> ExecuteAndCapture(Func<Context, TResult> action, Context context)

Executes the specified action within the policy and returns the captured result.

public PolicyResult<TResult> ExecuteAndCapture(Func<CancellationToken, TResult> action, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the captured result

public PolicyResult<TResult> ExecuteAndCapture(Func<CancellationToken, TResult> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the captured result.

public PolicyResult<TResult> ExecuteAndCapture(Func<CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the captured result.

public PolicyResult<TResult> ExecuteAndCapture(Func<Context, CancellationToken, TResult> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the captured result.

public PolicyResult<TResult> ExecuteAndCapture(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)

Executes the specified action within the policy and returns the captured result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Task<TResult>> action)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Task<TResult>> action, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Task<TResult>> action, IDictionary<string, object> contextData)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Task<TResult>> action, Context context)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Context, Task<TResult>> action, IDictionary<string, object> contextData)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Context, Task<TResult>> action, Context context)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Task<TResult>> action, IDictionary<string, object> contextData, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Task<TResult>> action, Context context, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Context, Task<TResult>> action, IDictionary<string, object> contextData, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Context, Task<TResult>> action, Context context, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<CancellationToken, Task<TResult>> action, CancellationToken cancellationToken)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<CancellationToken, Task<TResult>> action, CancellationToken cancellationToken, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Context, CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Context, CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<PolicyResult<TResult>> ExecuteAndCaptureAsync(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Task<TResult>> action)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Task<TResult>> action, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Task<TResult>> action, IDictionary<string, object> contextData)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Task<TResult>> action, Context context)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Context, Task<TResult>> action, IDictionary<string, object> contextData)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Context, Task<TResult>> action, Context context)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Task<TResult>> action, IDictionary<string, object> contextData, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Task<TResult>> action, Context context, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Context, Task<TResult>> action, IDictionary<string, object> contextData, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Context, Task<TResult>> action, Context context, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<CancellationToken, Task<TResult>> action, CancellationToken cancellationToken)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<CancellationToken, Task<TResult>> action, CancellationToken cancellationToken, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Context, CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Context, CancellationToken, Task<TResult>> action, IDictionary<string, object> contextData, CancellationToken cancellationToken, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Task<TResult> ExecuteAsync(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)

Executes the specified asynchronous action within the policy and returns the result.

public Policy<TResult> WithPolicyKey(string policyKey)

Sets the PolicyKey for this Policy instance. Must be called before the policy is first used. Can only be set once.

public PolicyWrap<TResult> Wrap(Policy innerPolicy)

Wraps the specified inner policy.

public PolicyWrap<TResult> Wrap(Policy<TResult> innerPolicy)

Wraps the specified inner policy.

public PolicyWrap<TResult> WrapAsync(Policy innerPolicy)

Wraps the specified inner policy.

public PolicyWrap<TResult> WrapAsync(Policy<TResult> innerPolicy)

Wraps the specified inner policy.