我的项目生成数百个请求,每个请求返回一个3 MB的JSON文件
我创建了一个基类来处理请求并返回我需要的对象 但是看来。他不能很好地处理请求量
protected IErrorLogger _errorLogger;
public BaseClient(IDeserializer serializer, IErrorLogger errorLogger, string baseUrl)
{
_errorLogger = errorLogger;
AddHandler("application/json", serializer);
AddHandler("text/json", serializer);
AddHandler("text/x-json", serializer);
BaseUrl = new Uri(baseUrl);
}
public T Get<T>(IRestRequest request) where T : new()
{
var response = Execute<T>(request);
if (response.StatusCode == System.Net.HttpStatusCode.OK)
{
return response.Data;
}
else
{
LogError(BaseUrl, request, response);
return default(T);
}
}
public override IRestResponse Execute(IRestRequest request)
{
var response = base.Execute(request);
TimeoutCheck(request, response);
return response;
}
public override IRestResponse<T> Execute<T>(IRestRequest request)
{
var response = base.Execute<T>(request);
TimeoutCheck(request, response);
return response;
}
您如何推荐我玩它?