Table of Contents

Interface IRestApiClientCache

Namespace
Ecng.Net
Assembly
Ecng.Net.Clients.dll

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 HttpMethod

The HTTP method to match for removal. Defaults to the default value of HttpMethod if not specified.

uriLike string

A string pattern to match part of the URI for removal. If null or empty, no URI filter is applied.

op ComparisonOperator

The 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 HttpMethod

The HTTP method of the request.

uri Uri

The URI of the request.

body object

The request body.

value T

The 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 HttpMethod

The HTTP method of the request.

uri Uri

The URI of the request.

body object

The request body.

value T

When 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.