Interface ICacheable<T>
This interface provides a generic method to invoke external functions and cache its results.
Namespace: TeleScope.Connectors.Http.Abstractions
Assembly: TeleScope.Connectors.Http.Abstractions.dll
Syntax
public interface ICacheable<T> : IDisposable
Type Parameters
| Name | Description |
|---|---|
| T | The result type T is the return value of the external call or the cached data. |
Methods
| Improve this Doc View SourceGetOrInvoke(String, Func<T>)
The implementation shall return the cached data, if the key holds it already or invokes the external function.
Declaration
T GetOrInvoke(string key, Func<T> invoke)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | The key that is used to store the result of the external function call. |
| Func<T> | invoke | The external function that shall be called if the cache contains no data. |
Returns
| Type | Description |
|---|---|
| T | The result of type T from cache or the external function call. |