protected void UpdateCommandCache() { ChannelCriterionCommandCache = new Dictionary <string, Dictionary <string, long> >(); var newRegexes = new HashSet <string>(); using (DemoderationContext ctx = GetNewContext()) { foreach (Criterion crit in ctx.Criteria.Where(c => c.Enabled)) { Dictionary <string, long> commandCacheForChannel = ObtainCommandCacheForChannel(crit.Channel); commandCacheForChannel[crit.Name] = crit.ID; newRegexes.Add(crit.DetectionRegex); } } RegexCache.ReplaceAllWith(newRegexes); }
protected virtual void RebuildRegexCache() { var newPatterns = new HashSet <string>(); foreach (BounceCriterion criterion in Config.Criteria) { if (criterion.ChannelRegexes != null) { newPatterns.UnionWith(criterion.ChannelRegexes); } if (criterion.NicknameRegexes != null) { newPatterns.UnionWith(criterion.NicknameRegexes); } } RegexCache.ReplaceAllWith(newPatterns); }