<PackageReference Include="Polly" Version="8.5.0" />

Policy

public abstract class Policy : PolicyBase, ISyncPolicy, IsPolicy
Transient exception handling policies that can be applied to synchronous delegates.
protected Policy(PolicyBuilder policyBuilder = null)

Initializes a new instance of the Policy class.

public static BulkheadPolicy Bulkhead(int maxParallelization)

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

public static BulkheadPolicy Bulkhead(int maxParallelization, Action<Context> onBulkheadRejected)

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

public static BulkheadPolicy Bulkhead(int maxParallelization, int maxQueuingActions)

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

public static BulkheadPolicy Bulkhead(int maxParallelization, int maxQueuingActions, Action<Context> onBulkheadRejected)

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

public static BulkheadPolicy<TResult> Bulkhead<TResult>(int maxParallelization)

Builds a bulkhead isolation Policy<T>, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

public static BulkheadPolicy<TResult> Bulkhead<TResult>(int maxParallelization, Action<Context> onBulkheadRejected)

Builds a bulkhead isolation Policy<T>, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

public static BulkheadPolicy<TResult> Bulkhead<TResult>(int maxParallelization, int maxQueuingActions)

Builds a bulkhead isolation Policy<T>, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

public static BulkheadPolicy<TResult> Bulkhead<TResult>(int maxParallelization, int maxQueuingActions, Action<Context> onBulkheadRejected)

Builds a bulkhead isolation Policy<T>, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

public static AsyncBulkheadPolicy BulkheadAsync(int maxParallelization)

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

public static AsyncBulkheadPolicy BulkheadAsync(int maxParallelization, Func<Context, Task> onBulkheadRejectedAsync)

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

public static AsyncBulkheadPolicy BulkheadAsync(int maxParallelization, int maxQueuingActions)

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

public static AsyncBulkheadPolicy BulkheadAsync(int maxParallelization, int maxQueuingActions, Func<Context, Task> onBulkheadRejectedAsync)

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

public static AsyncBulkheadPolicy<TResult> BulkheadAsync<TResult>(int maxParallelization)

Builds a bulkhead isolation AsyncPolicy<T>, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

public static AsyncBulkheadPolicy<TResult> BulkheadAsync<TResult>(int maxParallelization, Func<Context, Task> onBulkheadRejectedAsync)

Builds a bulkhead isolation AsyncPolicy<T>, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

public static AsyncBulkheadPolicy<TResult> BulkheadAsync<TResult>(int maxParallelization, int maxQueuingActions)

Builds a bulkhead isolation AsyncPolicy<T>, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

public static AsyncBulkheadPolicy<TResult> BulkheadAsync<TResult>(int maxParallelization, int maxQueuingActions, Func<Context, Task> onBulkheadRejectedAsync)

Builds a bulkhead isolation AsyncPolicy<T>, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

public static CachePolicy Cache(ISyncCacheProvider cacheProvider, TimeSpan ttl, Action<Context, string, Exception> onCacheError = null)

Builds a Policy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key specified by OperationKey. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy Cache(ISyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key specified by OperationKey. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy Cache(ISyncCacheProvider cacheProvider, TimeSpan ttl, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy Cache(ISyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy Cache(ISyncCacheProvider cacheProvider, TimeSpan ttl, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy Cache(ISyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy Cache(ISyncCacheProvider cacheProvider, TimeSpan ttl, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy Cache(ISyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy Cache(ISyncCacheProvider cacheProvider, TimeSpan ttl, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy Cache(ISyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy Cache(ISyncCacheProvider cacheProvider, TimeSpan ttl, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy Cache(ISyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider cacheProvider, TimeSpan ttl, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key specified by OperationKey. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key specified by OperationKey. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider cacheProvider, TimeSpan ttl, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider cacheProvider, TimeSpan ttl, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider cacheProvider, TimeSpan ttl, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider cacheProvider, TimeSpan ttl, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider cacheProvider, TimeSpan ttl, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, TimeSpan ttl, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key specified by OperationKey. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, ITtlStrategy ttlStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key specified by OperationKey. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, ITtlStrategy<TResult> ttlStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key specified by OperationKey. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, TimeSpan ttl, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, ITtlStrategy ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, ITtlStrategy<TResult> ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, TimeSpan ttl, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, ITtlStrategy ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, ITtlStrategy<TResult> ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, TimeSpan ttl, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, ITtlStrategy ttlStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, ITtlStrategy<TResult> ttlStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, TimeSpan ttl, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, ITtlStrategy ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, ITtlStrategy<TResult> ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, TimeSpan ttl, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, ITtlStrategy ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> cacheProvider, ITtlStrategy<TResult> ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds a Policy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, TimeSpan ttl, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key specified by OperationKey. If the cacheProvider provides a value, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key specified by OperationKey If the cacheProvider provides a value, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, TimeSpan ttl, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, TimeSpan ttl, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, TimeSpan ttl, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, TimeSpan ttl, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, TimeSpan ttl, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy that will function like a result cache for delegate executions returning a result.

Before executing a delegate returning a result, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider cacheProvider, TimeSpan ttl, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key specified by OperationKey. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key specified by OperationKey. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider cacheProvider, TimeSpan ttl, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider cacheProvider, TimeSpan ttl, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider cacheProvider, TimeSpan ttl, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider cacheProvider, TimeSpan ttl, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider cacheProvider, TimeSpan ttl, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider cacheProvider, ITtlStrategy ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, TimeSpan ttl, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key specified by OperationKey. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, ITtlStrategy ttlStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key specified by OperationKey. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, ITtlStrategy<TResult> ttlStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key specified by OperationKey. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, TimeSpan ttl, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, ITtlStrategy ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, ITtlStrategy<TResult> ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, TimeSpan ttl, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, ITtlStrategy ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, ITtlStrategy<TResult> ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string, Exception> onCacheError = null)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, TimeSpan ttl, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, ITtlStrategy ttlStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, ITtlStrategy<TResult> ttlStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, TimeSpan ttl, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, ITtlStrategy ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, ITtlStrategy<TResult> ttlStrategy, ICacheKeyStrategy cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, TimeSpan ttl, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, ITtlStrategy ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

public static AsyncCachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, ITtlStrategy<TResult> ttlStrategy, Func<Context, string> cacheKeyStrategy, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError)

Builds an AsyncPolicy<T> that will function like a result cache for delegate executions returning a TResult.

Before executing a delegate, checks whether the cacheProvider holds a value for the cache key determined by applying the cacheKeyStrategy to the execution Context. If the cacheProvider provides a value from cache, returns that value and does not execute the governed delegate. If the cacheProvider does not provide a value, executes the governed delegate, stores the value with the cacheProvider, then returns the value.

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

Specifies the type of exception that this policy can handle.

public static PolicyBuilder 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 HandleInner<TException>() where TException : Exception

Specifies the type of exception that this policy can handle if found as an InnerException of a regular Exception, or at any level of nesting within an AggregateException.

public static PolicyBuilder HandleInner<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, if found as an InnerException of a regular Exception, or at any level of nesting within an AggregateException.

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

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

public static PolicyBuilder<TResult> HandleResult<TResult>(TResult result)

Specifies the type of return result that this policy can handle, and a result value which the policy will handle.

public static NoOpPolicy NoOp()

Builds a NoOp Policy that will execute without any custom behavior.

public static NoOpPolicy<TResult> NoOp<TResult>()

Builds a NoOp Policy<T> that will execute without any custom behavior.

public static AsyncNoOpPolicy NoOpAsync()

Builds a NoOp AsyncPolicy that will execute without any custom behavior.

public static AsyncNoOpPolicy<TResult> NoOpAsync<TResult>()

Builds a NoOp AsyncPolicy<T> that will execute without any custom behavior.

public static RateLimitPolicy RateLimit(int numberOfExecutions, TimeSpan perTimeSpan)

Builds a RateLimit Policy that will rate-limit executions to numberOfExecutions per the timespan given.

public static RateLimitPolicy RateLimit(int numberOfExecutions, TimeSpan perTimeSpan, int maxBurst)

Builds a RateLimit Policy that will rate-limit executions to numberOfExecutions per the timespan given.

public static RateLimitPolicy<TResult> RateLimit<TResult>(int numberOfExecutions, TimeSpan perTimeSpan)

Builds a RateLimit Policy<T> that will rate-limit executions to numberOfExecutions per the timespan given.

public static RateLimitPolicy<TResult> RateLimit<TResult>(int numberOfExecutions, TimeSpan perTimeSpan, Func<TimeSpan, Context, TResult> retryAfterFactory)

Builds a RateLimit Policy<T> that will rate-limit executions to numberOfExecutions per the timespan given.

public static RateLimitPolicy<TResult> RateLimit<TResult>(int numberOfExecutions, TimeSpan perTimeSpan, int maxBurst)

Builds a RateLimit Policy<T> that will rate-limit executions to numberOfExecutions per the timespan given.

public static RateLimitPolicy<TResult> RateLimit<TResult>(int numberOfExecutions, TimeSpan perTimeSpan, int maxBurst, Func<TimeSpan, Context, TResult> retryAfterFactory)

Builds a RateLimit Policy<T> that will rate-limit executions to numberOfExecutions per the timespan given, with a maximum burst size of maxBurst.

public static AsyncRateLimitPolicy RateLimitAsync(int numberOfExecutions, TimeSpan perTimeSpan)

Builds a RateLimit AsyncPolicy that will rate-limit executions to numberOfExecutions per the timespan given.

public static AsyncRateLimitPolicy RateLimitAsync(int numberOfExecutions, TimeSpan perTimeSpan, int maxBurst)

Builds a RateLimit AsyncPolicy that will rate-limit executions to numberOfExecutions per the timespan given.

public static AsyncRateLimitPolicy<TResult> RateLimitAsync<TResult>(int numberOfExecutions, TimeSpan perTimeSpan)

Builds a RateLimit AsyncPolicy<T> that will rate-limit executions to numberOfExecutions per the timespan given.

public static AsyncRateLimitPolicy<TResult> RateLimitAsync<TResult>(int numberOfExecutions, TimeSpan perTimeSpan, Func<TimeSpan, Context, TResult> retryAfterFactory)

Builds a RateLimit AsyncPolicy<T> that will rate-limit executions to numberOfExecutions per the timespan given.

public static AsyncRateLimitPolicy<TResult> RateLimitAsync<TResult>(int numberOfExecutions, TimeSpan perTimeSpan, int maxBurst)

Builds a RateLimit AsyncPolicy<T> that will rate-limit executions to numberOfExecutions per the timespan given.

public static AsyncRateLimitPolicy<TResult> RateLimitAsync<TResult>(int numberOfExecutions, TimeSpan perTimeSpan, int maxBurst, Func<TimeSpan, Context, TResult> retryAfterFactory)

Builds a RateLimit AsyncPolicy<T> that will rate-limit executions to numberOfExecutions per the timespan given, with a maximum burst size of maxBurst.

public static TimeoutPolicy Timeout(int seconds)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(int seconds, TimeoutStrategy timeoutStrategy)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(int seconds, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(int seconds, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(int seconds, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(int seconds, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(TimeSpan timeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutStrategy timeoutStrategy)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(TimeSpan timeout, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(TimeSpan timeout, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(TimeSpan timeout, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(Func<TimeSpan> timeoutProvider)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(Func<TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(Func<TimeSpan> timeoutProvider, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(Func<TimeSpan> timeoutProvider, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(Func<TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(Func<TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(Func<Context, TimeSpan> timeoutProvider)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(Func<Context, TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(Func<Context, TimeSpan> timeoutProvider, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(Func<Context, TimeSpan> timeoutProvider, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(Func<Context, TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy Timeout(Func<Context, TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(int seconds)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(int seconds, TimeoutStrategy timeoutStrategy)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(int seconds, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(int seconds, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(int seconds, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(int seconds, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(TimeSpan timeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(TimeSpan timeout, TimeoutStrategy timeoutStrategy)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(TimeSpan timeout, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(TimeSpan timeout, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(TimeSpan timeout, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(TimeSpan timeout, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(Func<TimeSpan> timeoutProvider)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(Func<TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(Func<TimeSpan> timeoutProvider, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(Func<TimeSpan> timeoutProvider, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(Func<TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(Func<TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(Func<Context, TimeSpan> timeoutProvider)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(Func<Context, TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(Func<Context, TimeSpan> timeoutProvider, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(Func<Context, TimeSpan> timeoutProvider, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(Func<Context, TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static TimeoutPolicy<TResult> Timeout<TResult>(Func<Context, TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Action<Context, TimeSpan, Task, Exception> onTimeout)

Builds a Policy<T> that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(int seconds)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(int seconds, TimeoutStrategy timeoutStrategy)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(int seconds, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(int seconds, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(int seconds, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(int seconds, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(TimeSpan timeout)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(TimeSpan timeout, TimeoutStrategy timeoutStrategy)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(TimeSpan timeout, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(TimeSpan timeout, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(TimeSpan timeout, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(TimeSpan timeout, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(Func<TimeSpan> timeoutProvider)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(Func<TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(Func<TimeSpan> timeoutProvider, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(Func<TimeSpan> timeoutProvider, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(Func<TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(Func<TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(Func<Context, TimeSpan> timeoutProvider)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(Func<Context, TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(Func<Context, TimeSpan> timeoutProvider, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(Func<Context, TimeSpan> timeoutProvider, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(Func<Context, TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy TimeoutAsync(Func<Context, TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(int seconds)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(int seconds, TimeoutStrategy timeoutStrategy)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(int seconds, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(int seconds, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(int seconds, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(int seconds, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(TimeSpan timeout)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(TimeSpan timeout, TimeoutStrategy timeoutStrategy)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(TimeSpan timeout, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(TimeSpan timeout, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(TimeSpan timeout, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(TimeSpan timeout, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(Func<TimeSpan> timeoutProvider)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(Func<TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(Func<TimeSpan> timeoutProvider, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(Func<TimeSpan> timeoutProvider, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(Func<TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(Func<TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(Func<Context, TimeSpan> timeoutProvider)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(Func<Context, TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(Func<Context, TimeSpan> timeoutProvider, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(Func<Context, TimeSpan> timeoutProvider, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(Func<Context, TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static AsyncTimeoutPolicy<TResult> TimeoutAsync<TResult>(Func<Context, TimeSpan> timeoutProvider, TimeoutStrategy timeoutStrategy, Func<Context, TimeSpan, Task, Exception, Task> onTimeoutAsync)

Builds an AsyncPolicy<T> that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

public static PolicyWrap Wrap(ISyncPolicy[] policies)

Creates a PolicyWrap of the given policies.

public static PolicyWrap<TResult> Wrap<TResult>(ISyncPolicy<TResult>[] policies)

Creates a PolicyWrap of the given policies governing delegates returning values of type TResult.

public static AsyncPolicyWrap WrapAsync(IAsyncPolicy[] policies)

Creates a PolicyWrap of the given policies.

public static AsyncPolicyWrap<TResult> WrapAsync<TResult>(IAsyncPolicy<TResult>[] policies)

Creates a PolicyWrap of the given policies governing delegates returning values of type TResult.

public void Execute(Action action)

Executes the specified action within the policy.

public void Execute(Action<Context> action, IDictionary<string, object> contextData)

Executes the specified action within the policy.

public void Execute(Action<Context> action, Context context)

Executes the specified action within the policy.

public void Execute(Action<CancellationToken> action, CancellationToken cancellationToken)

Executes the specified action within the policy.

public void Execute(Action<Context, CancellationToken> action, IDictionary<string, object> contextData, CancellationToken cancellationToken)

Executes the specified action within the policy.

public void Execute(Action<Context, CancellationToken> action, Context context, CancellationToken cancellationToken)

Executes the specified action within the policy.

public TResult Execute<TResult>(Func<TResult> action)

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

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

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

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

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

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

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

public TResult Execute<TResult>(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<TResult>(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

public PolicyResult<TResult> ExecuteAndCapture<TResult>(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<TResult>(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)

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

protected virtual void Implementation(Action<Context, CancellationToken> action, Context context, CancellationToken cancellationToken)

Defines the implementation of a policy for sync executions with no return value.

protected abstract TResult Implementation<TResult>(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)

Defines the implementation of a policy for synchronous executions returning TResult.

public Policy 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 Wrap(ISyncPolicy innerPolicy)

Wraps the specified inner policy.

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

Wraps the specified inner policy.