/// <summary> /// Load Tất cả defTask vào cache /// </summary> /// <returns></returns> public async Task <List <DefTasks> > LoadAllDefTasks() { try { string key = ECacheKey.DefTasks.ToString(); var cachedData = _distributedCache.GetString(key); if (cachedData != null && cachedData != "null") { var defTasks = JsonConvert.DeserializeObject <List <DefTasks> >(cachedData); return(defTasks); } else { var defTasks = await _moduleService.GetAllDefTasks(); RedisUtils.SetCacheData(_distributedCache, _Configuration, defTasks, key); return(defTasks); } } catch (Exception e) { return(null); } }