private static void CheckCacheForVehicleAndTypeFillIfRequired( string vinU, AnalyticRuleType type) { if (!Cache.ContainsKey(vinU) || (Cache.ContainsKey(vinU) && Cache[vinU].Get(type) == null)) { lock (Cache) { if (!Cache.ContainsKey(vinU)) { Cache[vinU] = new StatisticsPerVehicleSubCache(); } Cache[vinU].Set(GetFromService(type, vinU), type); } } }
private static void CheckCacheForVehicleFillIfRequired(string vinU) { if (!Cache.ContainsKey(vinU)) { Cache[vinU] = new StatisticsPerVehicleSubCache(); } try { foreach (AnalyticRuleType type in AnalyticRuleSettingsCache.GetAvailableTypes(vinU)) { CheckCacheForVehicleAndTypeFillIfRequired(vinU, type); } } catch (Exception e) { Log.Error(e, "Can not get available analytic types for vehicle."); throw; } }