Open sandboxFocus

Method TryAsync

TryAsync(OperationKind, int, Exception, ref object, CancellationToken)

Determines if a Redis transaction should be tried, and throws a CachingException if it cannot.

Declaration
ValueTask<bool> TryAsync(OperationKind kind, int attempt, Exception exception, ref object state, CancellationToken cancellation = default)
Parameters
Type Name Description
OperationKind kind

The transaction kind.

int attempt

The index of the attempt. 0 indicates the first attempt, i.e. not a retry.

Exception exception

The Exception of the previous attempt, if any.

object state

A to an optional state of the operation, optionally set by the IRetryPolicy implementation and opaque to the caller.

CancellationToken cancellation

A CancellationToken.

Returns
Type Description
ValueTask<bool>

Always true. Must throw an exception if it cannot retry.