Interface IRestApiClientCache
Provides caching functionality for REST API client responses.
public interface IRestApiClientCache
- Extension Methods
Methods
Remove(HttpMethod, string, ComparisonOperator)
Removes cached entries based on the specified HTTP method and a URI pattern.
void Remove(HttpMethod method = null, string uriLike = null, ComparisonOperator op = ComparisonOperator.Greater)
Parameters
methodHttpMethodThe HTTP method to match for removal. Defaults to the default value of HttpMethod if not specified.
uriLikestringA string pattern to match part of the URI for removal. If null or empty, no URI filter is applied.
opComparisonOperatorThe comparison operator to apply when filtering URIs. Defaults to Greater if not specified.
Set<T>(HttpMethod, Uri, object, T)
Caches the specified value for the given HTTP method, URI, and request body.
void Set<T>(HttpMethod method, Uri uri, object body, T value)
Parameters
methodHttpMethodThe HTTP method of the request.
uriUriThe URI of the request.
bodyobjectThe request body.
valueTThe value to be cached.
Type Parameters
TThe type of the value to cache.
TryGet<T>(HttpMethod, Uri, object, out T)
Attempts to retrieve a cached value for the specified HTTP method, URI, and request body.
bool TryGet<T>(HttpMethod method, Uri uri, object body, out T value)
Parameters
methodHttpMethodThe HTTP method of the request.
uriUriThe URI of the request.
bodyobjectThe request body.
valueTWhen this method returns, contains the cached value if found; otherwise, the default value for the type.
Returns
- bool
true if a cached value was found; otherwise, false.
Type Parameters
TThe type of the cached value.