public ResponseData DoBatchWithDic(RequestType type, Dictionary <string, string> dic) { lock (_syncLocker) { RedisCoder.RequestForDic(type, dic); var result = RedisCoder.Decoder(type); if (result.Type == ResponseType.Redirect) { return((ResponseData)OnRedirect.Invoke(result.Data, OperationType.DoBatchWithDic, type, dic)); } else { return(result); } } }
public ResponseData DoMultiLineWithDic(RequestType type, Dictionary <string, string> dic) { ResponseData result = new ResponseData() { Type = ResponseType.Empty, Data = "未知的命令" }; try { result = TaskHelper.Run((token) => { lock (SyncRoot) { RedisCoder.RequestForDic(type, dic); var sresult = RedisCoder.Decoder(type, token); if (sresult != null && sresult.Type == ResponseType.Redirect) { return((ResponseData)OnRedirect.Invoke(sresult.Data, OperationType.DoBatchWithDic, type, dic)); } else { return(sresult); } } }, _actionTimeout).Result; } catch (TaskCanceledException tex) { result.Type = ResponseType.Error; result.Data = "Action Timeout"; } catch (Exception ex) { result.Type = ResponseType.Error; result.Data = ex.Message; } return(result); }
public ResponseData <string> DoMultiLineWithDic(RequestType type, Dictionary <string, string> dic) { ResponseData <string> result = new ResponseData <string>() { Type = ResponseType.Empty, Data = "未知的命令" }; try { lock (SyncRoot) { using (var cts = new CancellationTokenSource(_actionTimeout)) { RedisCoder.RequestForDic(type, dic); var sresult = RedisCoder.Decoder <string>(type, cts.Token); if (sresult != null && sresult.Type == ResponseType.Redirect) { return((ResponseData <string>)OnRedirect.Invoke(sresult.Data, OperationType.DoBatchWithDic, type, dic)); } else { return(sresult); } } } } catch (TaskCanceledException tex) { result.Type = ResponseType.Error; result.Data = "Action Timeout"; } catch (Exception ex) { result.Type = ResponseType.Error; result.Data = ex.Message; } return(result); }