public void DoJob()
 {
     using (var client = new PinTuanClient())
     {
         var result = client.RefreshCache();
         if (!(result.Success && result.Result.Code == 1))
         {
             Logger.Warn("刷新拼团首页模块数据失败");
         }
         var data = DalGroupBuying.GetAllPinTuanProduct();
         foreach (var item in data)
         {
             var resultItem = client.RefreshCache(item);
             if (!(result.Success && result.Result.Code == 1))
             {
                 Logger.Warn($"刷新拼团数据-->{item}--失败");
             }
         }
     }
     using (var client = new ShareBargainClient())
     {
         var result = client.RefreshShareBargainCache();
         if (!(result.Success && result.Result))
         {
             Logger.Warn("砍价首页模块数据失败");
         }
     }
 }
Beispiel #2
0
        public static bool RefrestPTCache(string groupId)
        {
            var result = false;

            try
            {
                using (var client = new PinTuanClient())
                {
                    var getResult = client.RefreshCache(groupId ?? string.Empty);
                    getResult.ThrowIfException(true);
                    result = getResult.Result.Code == 1;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
Beispiel #3
0
        public static async Task <bool> RefrestPTCache(string groupId)
        {
            var result = false;

            try
            {
                // 延迟3秒执行  ->  (读写分离)
                {
                    await Task.Delay(TimeSpan.FromSeconds(3));

                    using (var client = new PinTuanClient())
                    {
                        var getResult = client.RefreshCache(groupId ?? string.Empty);
                        getResult.ThrowIfException(true);
                        result = getResult.Result.Code == 1;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }