Interface ICache
Represents a cache.
Namespace: IRM.Extensions.Caching
Assembly: IRM.Extensions.Caching.dll
Syntax
public interface ICache
Methods
RefreshAsync(String, CancellationToken)
Refreshes a value in the cache based on its key, resetting its sliding expiration timeout (if any).
Declaration
Task RefreshAsync(string key, CancellationToken cancellationToken = default(CancellationToken))
Parameters
|
String
key
A string identifying the requested value. |
|
System.Threading.CancellationToken
cancellationToken
Optional, the System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
|
System.Threading.Tasks.Task
The System.Threading.Tasks.Task that represents the asynchronous operation. |
RemoveAsync(String, CancellationToken)
Removes the value with the given key.
Declaration
Task RemoveAsync(string key, CancellationToken cancellationToken = default(CancellationToken))
Parameters
|
String
key
A string identifying the requested value. |
|
System.Threading.CancellationToken
cancellationToken
Optional, the System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
|
System.Threading.Tasks.Task
The System.Threading.Tasks.Task that represents the asynchronous operation. |
SetAsync<TItem>(String, TItem, CacheEntryOptions, CancellationToken)
Sets the value with the given key.
Declaration
Task SetAsync<TItem>(string key, TItem value, CacheEntryOptions entryOptions, CancellationToken cancellationToken = default(CancellationToken))
Parameters
|
String
key
A string identifying the requested value. |
|
TItem
value
The type of the item. |
|
CacheEntryOptions
entryOptions
The cache options for the value. |
|
System.Threading.CancellationToken
cancellationToken
Optional, the System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
|
System.Threading.Tasks.Task
The System.Threading.Tasks.Task that represents the asynchronous operation. |
Type Parameters
|
TItem
|
TryGetValueAsync<TItem>(String, CancellationToken)
Tries to get a value with the given key.
Declaration
Task<(bool Succeeded, TItem Value)> TryGetValueAsync<TItem>(string key, CancellationToken cancellationToken = default(CancellationToken))
Parameters
|
String
key
A string identifying the requested value. |
|
System.Threading.CancellationToken
cancellationToken
Optional, the System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
|
System.Threading.Tasks.Task<(T1, T2)<Boolean, TItem>>
The System.Threading.Tasks.Task that represents the asynchronous operation, containing a System.Tuple`2. |
Type Parameters
|
TItem
The type of the item. |