using System.Collections.Generic; using AsbCloudApp.Services; using AsbCloudDb.Model; namespace AsbCloudInfrastructure.Services { public class SaubDataCache : ISaubDataCache { private readonly Dictionary> saubData = new Dictionary>(); public IEnumerable GetOrCreateCache(int telemetryId) { if (!saubData.ContainsKey(telemetryId)) saubData[telemetryId] = new List(); return saubData[telemetryId]; } public void AddData(DataSaubBase data) { GetOrCreateCache(data.IdTelemetry); saubData[data.IdTelemetry].Add(data); if (saubData[data.IdTelemetry].Count > 10) saubData[data.IdTelemetry].RemoveAt(1); } } }