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
method
HttpMethodThe HTTP method to match for removal. Defaults to the default value of HttpMethod if not specified.
uriLike
stringA string pattern to match part of the URI for removal. If null or empty, no URI filter is applied.
op
ComparisonOperatorThe 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
method
HttpMethodThe HTTP method of the request.
uri
UriThe URI of the request.
body
objectThe request body.
value
TThe value to be cached.
Type Parameters
T
The 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
method
HttpMethodThe HTTP method of the request.
uri
UriThe URI of the request.
body
objectThe request body.
value
TWhen 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
T
The type of the cached value.