namespace IStation.Server { /// /// /// public class EquipmentRunAnalyChangeTimesHelper { private static ConcurrentDictionary> _dict = new();//缓存 /// /// 设置 /// public static void Set(long configureId, int changeTimes, Yw.Model.MonitorRealRecord record) { _dict.TryAdd(configureId, new List()); if (_dict[configureId].Count >= changeTimes) { _dict[configureId].RemoveAt(0); } if (record != null) { _dict[configureId].Add(record); } } /// /// 是否改变 /// public static bool HasChanged(long configureId, int changeTimes) { if (!_dict.ContainsKey(configureId)) { return false; } if (_dict[configureId].Count < changeTimes) { return false; } if (_dict[configureId].Select(x => x.DataValue).Distinct().Count() > 1) { return false; } return true; } } }