PolicyRegistry
public class PolicyRegistry : IConcurrentPolicyRegistry<string>, IPolicyRegistry<string>, IReadOnlyPolicyRegistry<string>, IEnumerable<KeyValuePair<string, IsPolicy>>, IEnumerable
Stores a registry of String and policy pairs.
Total number of policies in the registry.
Gets of sets the IsPolicy with the specified key.
To retrieve a policy directly as a particular Policy type or Policy interface (avoiding a cast), use the Get<T> method.
public PolicyRegistry()
Creates a registry of policies with String keys.
Adds a policy with the provided key and policy to the registry.
public TPolicy AddOrUpdate<TPolicy>(string key, Func<string, TPolicy> addPolicyFactory, Func<string, 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.
public TPolicy AddOrUpdate<TPolicy>(string key, TPolicy addPolicy, Func<string, 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.
Removes all keys and policies from registry.
Determines whether the specified key exists.
Gets the policy stored under the provided key, casting to TPolicy.
Returns an enumerator that iterates through the policy objects in the PolicyRegistry.
public TPolicy GetOrAdd<TPolicy>(string key, Func<string, TPolicy> policyFactory) where TPolicy : IsPolicy
Adds a policy with the provided key and policy to the registry
if the key does not already exist.
Adds a key/policy pair to the registry
if the key does not already exist.
Removes the policy stored under the specified key from the registry.
Adds a policy with the provided key and policy to the registry.
Gets the policy stored under the provided key, casting to TPolicy.
Removes the policy stored under the specified key from the registry.
public bool TryUpdate<TPolicy>(string 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.