Skip to main content

CachedHttpClient

Assembly: ServiceStack.HttpClient.dll
View Source
Declaration
public class CachedHttpClient : ICachedServiceClient, IServiceClient, IRestServiceClient, IServiceClientAsync, IServiceGatewayAsync, IServiceClientSync, IHasSessionId, IHasBearerToken, IHasVersion, IHttpRestClientAsync, IRestClientAsync, IReplyClient, IServiceGateway, IOneWayClient, IRestClient, IRestClientSync, IServiceClientCommon, IDisposable

Properties

ClearCachesOlderThan

View Source
Declaration
public TimeSpan? ClearCachesOlderThan { get; set; }

ClearExpiredCachesOlderThan

View Source
Declaration
public TimeSpan? ClearExpiredCachesOlderThan { get; set; }

CleanCachesWhenCountExceeds

View Source
Declaration
public int CleanCachesWhenCountExceeds { get; set; }

CacheCount

View Source
Declaration
public int CacheCount { get; }

CacheHits

View Source
Declaration
public long CacheHits { get; }

NotModifiedHits

View Source
Declaration
public long NotModifiedHits { get; }

ErrorFallbackHits

View Source
Declaration
public long ErrorFallbackHits { get; }

CachesAdded

View Source
Declaration
public long CachesAdded { get; }

CachesRemoved

View Source
Declaration
public long CachesRemoved { get; }

SessionId

View Source
Declaration
public string SessionId { get; set; }

BearerToken

View Source
Declaration
public string BearerToken { get; set; }

Version

View Source
Declaration
public int Version { get; set; }

Methods

OnExceptionFilter(HttpResponseMessage, String, Type)

View Source
Declaration
public object OnExceptionFilter(HttpResponseMessage webRes, string requestUri, Type responseType)
Returns

System.Object

Parameters
TypeName
System.Net.Http.HttpResponseMessagewebRes
System.StringrequestUri
System.TyperesponseType

SetCache(ConcurrentDictionary<String, HttpCacheEntry>)

View Source
Declaration
public void SetCache(ConcurrentDictionary<string, HttpCacheEntry> cache)
Parameters
TypeName
System.Collections.Concurrent.ConcurrentDictionary<System.String,ServiceStack.HttpCacheEntry>cache

RemoveCachesOlderThan(TimeSpan)

View Source
Declaration
public int RemoveCachesOlderThan(TimeSpan age)
Returns

System.Int32

Parameters
TypeName
System.TimeSpanage

RemoveExpiredCachesOlderThan(TimeSpan)

View Source
Declaration
public int RemoveExpiredCachesOlderThan(TimeSpan age)
Returns

System.Int32

Parameters
TypeName
System.TimeSpanage

Dispose()

View Source
Declaration
public void Dispose()

SetCredentials(String, String)

View Source
Declaration
public void SetCredentials(string userName, string password)
Parameters
TypeName
System.StringuserName
System.Stringpassword

GetAsync<TResponse>(IReturn<TResponse>, CancellationToken)

View Source
Declaration
public Task<TResponse> GetAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

GetAsync<TResponse>(Object, CancellationToken)

View Source
Declaration
public Task<TResponse> GetAsync<TResponse>(object requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.ObjectrequestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

GetAsync<TResponse>(String, CancellationToken)

View Source
Declaration
public Task<TResponse> GetAsync<TResponse>(string relativeOrAbsoluteUrl, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

GetAsync(IReturnVoid, CancellationToken)

View Source
Declaration
public Task GetAsync(IReturnVoid requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.IReturnVoidrequestDto
System.Threading.CancellationTokentoken

DeleteAsync<TResponse>(IReturn<TResponse>, CancellationToken)

View Source
Declaration
public Task<TResponse> DeleteAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

DeleteAsync<TResponse>(Object, CancellationToken)

View Source
Declaration
public Task<TResponse> DeleteAsync<TResponse>(object requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.ObjectrequestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

DeleteAsync<TResponse>(String, CancellationToken)

View Source
Declaration
public Task<TResponse> DeleteAsync<TResponse>(string relativeOrAbsoluteUrl, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

DeleteAsync(IReturnVoid, CancellationToken)

View Source
Declaration
public Task DeleteAsync(IReturnVoid requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.IReturnVoidrequestDto
System.Threading.CancellationTokentoken

PostAsync<TResponse>(IReturn<TResponse>, CancellationToken)

View Source
Declaration
public Task<TResponse> PostAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PostAsync<TResponse>(Object, CancellationToken)

View Source
Declaration
public Task<TResponse> PostAsync<TResponse>(object requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.ObjectrequestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PostAsync<TResponse>(String, Object, CancellationToken)

View Source
Declaration
public Task<TResponse> PostAsync<TResponse>(string relativeOrAbsoluteUrl, object request, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.Objectrequest
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PostAsync(IReturnVoid, CancellationToken)

View Source
Declaration
public Task PostAsync(IReturnVoid requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.IReturnVoidrequestDto
System.Threading.CancellationTokentoken

PutAsync<TResponse>(IReturn<TResponse>, CancellationToken)

View Source
Declaration
public Task<TResponse> PutAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PutAsync<TResponse>(Object, CancellationToken)

View Source
Declaration
public Task<TResponse> PutAsync<TResponse>(object requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.ObjectrequestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PutAsync<TResponse>(String, Object, CancellationToken)

View Source
Declaration
public Task<TResponse> PutAsync<TResponse>(string relativeOrAbsoluteUrl, object request, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.Objectrequest
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PutAsync(IReturnVoid, CancellationToken)

View Source
Declaration
public Task PutAsync(IReturnVoid requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.IReturnVoidrequestDto
System.Threading.CancellationTokentoken

PatchAsync<TResponse>(IReturn<TResponse>, CancellationToken)

View Source
Declaration
public Task<TResponse> PatchAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PatchAsync<TResponse>(Object, CancellationToken)

View Source
Declaration
public Task<TResponse> PatchAsync<TResponse>(object requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.ObjectrequestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PatchAsync(IReturnVoid, CancellationToken)

View Source
Declaration
public Task PatchAsync(IReturnVoid requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.IReturnVoidrequestDto
System.Threading.CancellationTokentoken

SendAsync<TResponse>(String, String, Object, CancellationToken)

View Source
Declaration
public Task<TResponse> SendAsync<TResponse>(string httpMethod, string absoluteUrl, object request, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringhttpMethod
System.StringabsoluteUrl
System.Objectrequest
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

CustomMethodAsync<TResponse>(String, IReturn<TResponse>, CancellationToken)

View Source
Declaration
public Task<TResponse> CustomMethodAsync<TResponse>(string httpVerb, IReturn<TResponse> requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringhttpVerb
ServiceStack.IReturn<T>requestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

CustomMethodAsync<TResponse>(String, Object, CancellationToken)

View Source
Declaration
public Task<TResponse> CustomMethodAsync<TResponse>(string httpVerb, object requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringhttpVerb
System.ObjectrequestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

CustomMethodAsync(String, IReturnVoid, CancellationToken)

View Source
Declaration
public Task CustomMethodAsync(string httpVerb, IReturnVoid requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.StringhttpVerb
ServiceStack.IReturnVoidrequestDto
System.Threading.CancellationTokentoken

CustomMethodAsync<TResponse>(String, String, Object, CancellationToken)

View Source
Declaration
public Task<TResponse> CustomMethodAsync<TResponse>(string httpVerb, string relativeOrAbsoluteUrl, object request, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringhttpVerb
System.StringrelativeOrAbsoluteUrl
System.Objectrequest
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

CancelAsync()

View Source
Declaration
public void CancelAsync()

SendOneWay(Object)

View Source
Declaration
public void SendOneWay(object requestDto)
Parameters
TypeName
System.ObjectrequestDto

SendOneWay(String, Object)

View Source
Declaration
public void SendOneWay(string relativeOrAbsoluteUri, object requestDto)
Parameters
TypeName
System.StringrelativeOrAbsoluteUri
System.ObjectrequestDto

SendAllOneWay(IEnumerable<Object>)

View Source
Declaration
public void SendAllOneWay(IEnumerable<object> requests)
Parameters
TypeName
System.Collections.Generic.IEnumerable<System.Object>requests

AddHeader(String, String)

View Source
Declaration
public void AddHeader(string name, string value)
Parameters
TypeName
System.Stringname
System.Stringvalue

ClearCookies()

View Source
Declaration
public void ClearCookies()

GetCookieValues()

View Source
Declaration
public Dictionary<string, string> GetCookieValues()
Returns

System.Collections.Generic.Dictionary<System.String,System.String>

SetCookie(String, String, Nullable<TimeSpan>)

View Source
Declaration
public void SetCookie(string name, string value, TimeSpan? expiresIn = null)
Parameters
TypeName
System.Stringname
System.Stringvalue
System.Nullable<System.TimeSpan>expiresIn

Get(IReturnVoid)

View Source
Declaration
public void Get(IReturnVoid request)
Parameters
TypeName
ServiceStack.IReturnVoidrequest

Get<TResponse>(IReturn<TResponse>)

View Source
Declaration
public TResponse Get<TResponse>(IReturn<TResponse> requestDto)
Returns

<TResponse>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
Type Parameters
  • TResponse

Get<TResponse>(Object)

View Source
Declaration
public TResponse Get<TResponse>(object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.ObjectrequestDto
Type Parameters
  • TResponse

Get<TResponse>(String)

View Source
Declaration
public TResponse Get<TResponse>(string relativeOrAbsoluteUrl)
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
Type Parameters
  • TResponse

GetLazy<TResponse>(IReturn<QueryResponse<TResponse>>)

View Source
Declaration
public IEnumerable<TResponse> GetLazy<TResponse>(IReturn<QueryResponse<TResponse>> queryDto)
Returns

System.Collections.Generic.IEnumerable<<TResponse>>

Parameters
TypeName
ServiceStack.IReturn<T>queryDto
Type Parameters
  • TResponse

Delete(IReturnVoid)

View Source
Declaration
public void Delete(IReturnVoid requestDto)
Parameters
TypeName
ServiceStack.IReturnVoidrequestDto

Delete<TResponse>(IReturn<TResponse>)

View Source
Declaration
public TResponse Delete<TResponse>(IReturn<TResponse> request)
Returns

<TResponse>

Parameters
TypeName
ServiceStack.IReturn<T>request
Type Parameters
  • TResponse

Delete<TResponse>(Object)

View Source
Declaration
public TResponse Delete<TResponse>(object request)
Returns

<TResponse>

Parameters
TypeName
System.Objectrequest
Type Parameters
  • TResponse

Delete<TResponse>(String)

View Source
Declaration
public TResponse Delete<TResponse>(string relativeOrAbsoluteUrl)
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
Type Parameters
  • TResponse

Post(IReturnVoid)

View Source
Declaration
public void Post(IReturnVoid requestDto)
Parameters
TypeName
ServiceStack.IReturnVoidrequestDto

Post<TResponse>(IReturn<TResponse>)

View Source
Declaration
public TResponse Post<TResponse>(IReturn<TResponse> requestDto)
Returns

<TResponse>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
Type Parameters
  • TResponse

Post<TResponse>(Object)

View Source
Declaration
public TResponse Post<TResponse>(object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.ObjectrequestDto
Type Parameters
  • TResponse

Post<TResponse>(String, Object)

View Source
Declaration
public TResponse Post<TResponse>(string relativeOrAbsoluteUrl, object request)
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.Objectrequest
Type Parameters
  • TResponse

Put(IReturnVoid)

View Source
Declaration
public void Put(IReturnVoid requestDto)
Parameters
TypeName
ServiceStack.IReturnVoidrequestDto

Put<TResponse>(IReturn<TResponse>)

View Source
Declaration
public TResponse Put<TResponse>(IReturn<TResponse> requestDto)
Returns

<TResponse>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
Type Parameters
  • TResponse

Put<TResponse>(Object)

View Source
Declaration
public TResponse Put<TResponse>(object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.ObjectrequestDto
Type Parameters
  • TResponse

Put<TResponse>(String, Object)

View Source
Declaration
public TResponse Put<TResponse>(string relativeOrAbsoluteUrl, object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.ObjectrequestDto
Type Parameters
  • TResponse

Patch(IReturnVoid)

View Source
Declaration
public void Patch(IReturnVoid requestDto)
Parameters
TypeName
ServiceStack.IReturnVoidrequestDto

Patch<TResponse>(IReturn<TResponse>)

View Source
Declaration
public TResponse Patch<TResponse>(IReturn<TResponse> requestDto)
Returns

<TResponse>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
Type Parameters
  • TResponse

Patch<TResponse>(Object)

View Source
Declaration
public TResponse Patch<TResponse>(object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.ObjectrequestDto
Type Parameters
  • TResponse

Patch<TResponse>(String, Object)

View Source
Declaration
public TResponse Patch<TResponse>(string relativeOrAbsoluteUrl, object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.ObjectrequestDto
Type Parameters
  • TResponse

Send<TResponse>(String, String, Object)

View Source
Declaration
public TResponse Send<TResponse>(string httpMethod, string relativeOrAbsoluteUrl, object request)
Returns

<TResponse>

Parameters
TypeName
System.StringhttpMethod
System.StringrelativeOrAbsoluteUrl
System.Objectrequest
Type Parameters
  • TResponse

CustomMethod(String, IReturnVoid)

View Source
Declaration
public void CustomMethod(string httpVerb, IReturnVoid requestDto)
Parameters
TypeName
System.StringhttpVerb
ServiceStack.IReturnVoidrequestDto

CustomMethod<TResponse>(String, IReturn<TResponse>)

View Source
Declaration
public TResponse CustomMethod<TResponse>(string httpVerb, IReturn<TResponse> requestDto)
Returns

<TResponse>

Parameters
TypeName
System.StringhttpVerb
ServiceStack.IReturn<T>requestDto
Type Parameters
  • TResponse

CustomMethod<TResponse>(String, Object)

View Source
Declaration
public TResponse CustomMethod<TResponse>(string httpVerb, object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.StringhttpVerb
System.ObjectrequestDto
Type Parameters
  • TResponse

PostFile<TResponse>(String, Stream, String, String, String)

View Source
Declaration
public TResponse PostFile<TResponse>(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, string mimeType, string fieldName = "file")
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.IO.StreamfileToUpload
System.StringfileName
System.StringmimeType
System.StringfieldName
Type Parameters
  • TResponse

PostFileWithRequest<TResponse>(Stream, String, Object, String)

View Source
Declaration
public TResponse PostFileWithRequest<TResponse>(Stream fileToUpload, string fileName, object request, string fieldName = "file")
Returns

<TResponse>

Parameters
TypeName
System.IO.StreamfileToUpload
System.StringfileName
System.Objectrequest
System.StringfieldName
Type Parameters
  • TResponse

PostFileWithRequest<TResponse>(String, Stream, String, Object, String)

View Source
Declaration
public TResponse PostFileWithRequest<TResponse>(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, object request, string fieldName = "file")
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.IO.StreamfileToUpload
System.StringfileName
System.Objectrequest
System.StringfieldName
Type Parameters
  • TResponse

PostFilesWithRequest<TResponse>(Object, IEnumerable<UploadFile>)

View Source
Declaration
public TResponse PostFilesWithRequest<TResponse>(object request, IEnumerable<UploadFile> files)
Returns

<TResponse>

Parameters
TypeName
System.Objectrequest
System.Collections.Generic.IEnumerable<ServiceStack.UploadFile>files
Type Parameters
  • TResponse

PostFilesWithRequest<TResponse>(String, Object, IEnumerable<UploadFile>)

View Source
Declaration
public TResponse PostFilesWithRequest<TResponse>(string relativeOrAbsoluteUrl, object request, IEnumerable<UploadFile> files)
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.Objectrequest
System.Collections.Generic.IEnumerable<ServiceStack.UploadFile>files
Type Parameters
  • TResponse

Send<TResponse>(Object)

View Source
Declaration
public TResponse Send<TResponse>(object request)
Returns

<TResponse>

Parameters
TypeName
System.Objectrequest
Type Parameters
  • TResponse

SendAll<TResponse>(IEnumerable<Object>)

View Source
Declaration
public List<TResponse> SendAll<TResponse>(IEnumerable<object> requests)
Returns

System.Collections.Generic.List<<TResponse>>

Parameters
TypeName
System.Collections.Generic.IEnumerable<System.Object>requests
Type Parameters
  • TResponse

Publish(Object)

View Source
Declaration
public void Publish(object requestDto)
Parameters
TypeName
System.ObjectrequestDto

PublishAll(IEnumerable<Object>)

View Source
Declaration
public void PublishAll(IEnumerable<object> requestDtos)
Parameters
TypeName
System.Collections.Generic.IEnumerable<System.Object>requestDtos

SendAsync<TResponse>(Object, CancellationToken)

View Source
Declaration
public Task<TResponse> SendAsync<TResponse>(object requestDto, CancellationToken token)
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.ObjectrequestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

SendAllAsync<TResponse>(IEnumerable<Object>, CancellationToken)

View Source
Declaration
public Task<List<TResponse>> SendAllAsync<TResponse>(IEnumerable<object> requests, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Collections.Generic.List<<TResponse>>>

Parameters
TypeName
System.Collections.Generic.IEnumerable<System.Object>requests
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PublishAsync(Object, CancellationToken)

View Source
Declaration
public Task PublishAsync(object requestDto, CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.ObjectrequestDto
System.Threading.CancellationTokentoken

PublishAllAsync(IEnumerable<Object>, CancellationToken)

View Source
Declaration
public Task PublishAllAsync(IEnumerable<object> requestDtos, CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Collections.Generic.IEnumerable<System.Object>requestDtos
System.Threading.CancellationTokentoken

Implements