public CachePolicyElement GetPolicyElementFor(object cacheKey) { var matchingRule = Rules.OfType<CachePolicyPickerRule>().FirstOrDefault(x => x.KeyMatches(cacheKey)); _defaultPolicy = _defaultPolicy ?? ParentConfig.Policies.FirstOrDefault(x => x.Name.InvariantEquals(ParentConfig.Policies.DefaultPolicyName)); if (matchingRule != null) { var getPolicy = ParentConfig.Policies.FirstOrDefault(x => x.Name.InvariantEquals(matchingRule.UsePolicyName)); if (getPolicy != null) return getPolicy; } return _defaultPolicy; }
public CachePolicyElement GetPolicyElementFor(object cacheKey) { var matchingRule = Rules.OfType <CachePolicyPickerRule>().FirstOrDefault(x => x.KeyMatches(cacheKey)); _defaultPolicy = _defaultPolicy ?? ParentConfig.Policies.FirstOrDefault(x => x.Name.InvariantEquals(ParentConfig.Policies.DefaultPolicyName)); if (matchingRule != null) { var getPolicy = ParentConfig.Policies.FirstOrDefault(x => x.Name.InvariantEquals(matchingRule.UsePolicyName)); if (getPolicy != null) { return(getPolicy); } } return(_defaultPolicy); }