public void StoreRange(OhlcData data, TimeRange rangeAttempted) { lock (Lock) { if (data == null) { return; } if (CoverageMap.Found.Covers(rangeAttempted)) { return; } Parallel.ForEach(data, x => x.SeriesId = _adapter.SeriesId); MemoryCache.AddRange(data); CoverageMap.Include(rangeAttempted, data); } }
public void StoreRange(OhlcData data, TimeRange rangeAttempted) { lock (Lock) { if (data == null) { return; } var isInDb = CoverageMap.Found.Covers(rangeAttempted); if (isInDb) { return; } var seriesId = _adapter.SeriesId; var col = PublicContext.I.GetCollection <OhlcEntry>(); data.ForEach(x => x.SeriesId = seriesId); col.Upsert(data); CoverageMap.Include(rangeAttempted, data); } }