private void AddOrUpdateCounter(ConcurrentDictionary <Guid, RawDomainStatistics> dictionary, IPageSelector data, PageRequest request) { if (RawGatheringRequestModule.Contains(data)) { RawDomainStatistics counter = dictionary.GetOrAdd(data.Id, new RawDomainStatistics(data)); counter.AddItemInCounter(request); } }
public void Gather(Dictionary <Guid, RawDomainStatistics> stats) { foreach (var key in Stats.Keys) { var value = Stats[key]; RawDomainStatistics stat; if (!stats.TryGetValue(key, out stat)) { stats.Add(key, stat = new RawDomainStatistics((IPageSelector)value)); } stat.AddItemsInCounter(value.Requests); } }
private void Reset(ConcurrentDictionary <Guid, RawDomainStatistics> counters, Dictionary <Guid, RawDomainStatistics> stats) { foreach (var key in counters.Keys) { var value = counters[key]; counters[key] = new RawDomainStatistics((IPageSelector)value); RawDomainStatistics stat; if (!stats.TryGetValue(key, out stat)) { stats.Add(key, stat = new RawDomainStatistics((IPageSelector)value)); } stat.AddItemsInCounter(value.Requests); } }