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

IConcurrentPolicyRegistry<TKey>

Represents a collection of policies keyed by TKey which can be updated and consumed in a thread-safe manner.
TPolicy AddOrUpdate<TPolicy>(TKey key, Func<TKey, TPolicy> addPolicyFactory, Func<TKey, TPolicy, TPolicy> updatePolicyFactory) where TPolicy : IsPolicy

Adds a key/policy pair to the registry if the key does not already exist, or updates a key/policy pair in the registry if the key already exists.

TPolicy AddOrUpdate<TPolicy>(TKey key, TPolicy addPolicy, Func<TKey, TPolicy, TPolicy> updatePolicyFactory) where TPolicy : IsPolicy

Adds a key/policy pair to the registry if the key does not already exist, or updates a key/policy pair in the registry if the key already exists.

TPolicy GetOrAdd<TPolicy>(TKey key, Func<TKey, TPolicy> policyFactory) where TPolicy : IsPolicy

Adds a policy with the provided key and policy to the registry if the key does not already exist.

TPolicy GetOrAdd<TPolicy>(TKey key, TPolicy policy) where TPolicy : IsPolicy

Adds a key/policy pair to the registry if the key does not already exist.

bool TryAdd<TPolicy>(TKey key, TPolicy policy) where TPolicy : IsPolicy

Adds an element with the provided key and policy to the registry.

bool TryRemove<TPolicy>(TKey key, out TPolicy policy) where TPolicy : IsPolicy

Removes the policy stored under the specified key from the registry.

bool TryUpdate<TPolicy>(TKey key, TPolicy newPolicy, TPolicy comparisonPolicy) where TPolicy : IsPolicy

Compares the existing policy for the specified key with a specified policy, and if they are equal, updates the policy with a third value.