/// <summary> /// 获取所有活动地区 /// </summary> /// <returns></returns> public static async Task <IEnumerable <T_ArearModel> > GetAllAreaAsync() { var key = $"GetAllAreaAsync"; using (var client = CacheHelper.CreateCacheClient(DefaultClientName)) { var result = await client.GetOrSetAsync(key, () => DalActivity.GetAllAreaAsync(), ActivityCacheExpiration); IEnumerable <T_ArearModel> xhrActivity; if (result.Success) { xhrActivity = result.Value; } else { Logger.Warn($"获取redis数据失败SelectAllArea:{key};Error:{result.Message}", result.Exception); // redis查询失败查数据库 xhrActivity = await DalActivity.GetAllAreaAsync(); } if (xhrActivity != null && xhrActivity.Any()) { return(xhrActivity); } return(null); } }