/// <summary> /// Save config to redis and update memory /// </summary> /// <param name="config"></param> /// <param name="scheduledTasks"></param> public static void Save(ConfigDto config, List<ScheduledTaskDto> scheduledTasks) { var configService = new ConfigService(); configService.SaveScheduledTasks(scheduledTasks); config.ScheduledTaskIds = scheduledTasks.Select(x => x.TaskId).ToList(); configService.SaveConfig(config); _scheduledTasks = scheduledTasks; _configuration = config; }
/// <summary> /// Get config from redis /// </summary> public static ConfigDto Load() { var configService = new ConfigService(); _configuration = configService.GetConfig(); if (_configuration == null) return null; _scheduledTasks = configService.GetScheduledTasks(_configuration.ScheduledTaskIds); return _configuration; }
public static void UpdateScheduledTask(ScheduledTaskDto scheduledTask) { var configService = new ConfigService(); configService.SaveScheduledTask(scheduledTask); }