示例#1
0
 /// <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;
 }
示例#2
0
        /// <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;
        }
示例#3
0
 public static void UpdateScheduledTask(ScheduledTaskDto scheduledTask)
 {
     var configService = new ConfigService();
     configService.SaveScheduledTask(scheduledTask);
 }