MetalamaAPI documentationPatterns APIMetalama.​Patterns.​CachingCaching­Service­ExtensionsRefresh­Async
Open sandboxFocus

CachingServiceExtensions.RefreshAsync Method

RefreshAsync<TReturn>(ICachingService, Func<Task<TReturn>>, CancellationToken)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 0 parameter.

Declaration
public static Task<TReturn> RefreshAsync<TReturn>(this ICachingService cachingService, Func<Task<TReturn>> method, CancellationToken cancellationToken = null)
Parameters
Type Name Description
ICachingService cachingService

The ICachingService.

System.Func<System.Threading.Tasks.Task<TReturn>> method

A delegate of the method to evaluate.

System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TReturn>

A System.Threading.Tasks.Task<> that evaluates to the return value of method.

Type Parameters
Name Description
TReturn

The return type of the method.

RefreshAsync<TReturn, TParam1>(ICachingService, Func<TParam1, Task<TReturn>>, TParam1, CancellationToken)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 1 parameter.

Declaration
public static Task<TReturn> RefreshAsync<TReturn, TParam1>(this ICachingService cachingService, Func<TParam1, Task<TReturn>> method, TParam1 arg1, CancellationToken cancellationToken = null)
Parameters
Type Name Description
ICachingService cachingService

The ICachingService.

System.Func<TParam1, System.Threading.Tasks.Task<TReturn>> method

A delegate of the method to evaluate.

TParam1 arg1

Value of the first parameter.

System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TReturn>

A System.Threading.Tasks.Task<> that evaluates to the return value of method.

Type Parameters
Name Description
TReturn

The return type of the method.

TParam1

Type of the first parameter.

RefreshAsync<TReturn, TParam1, TParam2>(ICachingService, Func<TParam1, TParam2, Task<TReturn>>, TParam1, TParam2, CancellationToken)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 2 parameters.

Declaration
public static Task<TReturn> RefreshAsync<TReturn, TParam1, TParam2>(this ICachingService cachingService, Func<TParam1, TParam2, Task<TReturn>> method, TParam1 arg1, TParam2 arg2, CancellationToken cancellationToken = null)
Parameters
Type Name Description
ICachingService cachingService

The ICachingService.

System.Func<TParam1, TParam2, System.Threading.Tasks.Task<TReturn>> method

A delegate of the method to evaluate.

TParam1 arg1

Value of the first parameter.

TParam2 arg2

Value of the second parameter.

System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TReturn>

A System.Threading.Tasks.Task<> that evaluates to the return value of method.

Type Parameters
Name Description
TReturn

The return type of the method.

TParam1

Type of the first parameter.

TParam2

Type of the second parameter.

RefreshAsync<TReturn, TParam1, TParam2, TParam3>(ICachingService, Func<TParam1, TParam2, TParam3, Task<TReturn>>, TParam1, TParam2, TParam3, CancellationToken)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 3 parameters.

Declaration
public static Task<TReturn> RefreshAsync<TReturn, TParam1, TParam2, TParam3>(this ICachingService cachingService, Func<TParam1, TParam2, TParam3, Task<TReturn>> method, TParam1 arg1, TParam2 arg2, TParam3 arg3, CancellationToken cancellationToken = null)
Parameters
Type Name Description
ICachingService cachingService

The ICachingService.

System.Func<TParam1, TParam2, TParam3, System.Threading.Tasks.Task<TReturn>> method

A delegate of the method to evaluate.

TParam1 arg1

Value of the first parameter.

TParam2 arg2

Value of the second parameter.

TParam3 arg3

Value of the third parameter.

System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TReturn>

A System.Threading.Tasks.Task<> that evaluates to the return value of method.

Type Parameters
Name Description
TReturn

The return type of the method.

TParam1

Type of the first parameter.

TParam2

Type of the second parameter.

TParam3

Type of the third parameter.

RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4>(ICachingService, Func<TParam1, TParam2, TParam3, TParam4, Task<TReturn>>, TParam1, TParam2, TParam3, TParam4, CancellationToken)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 4 parameters.

Declaration
public static Task<TReturn> RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4>(this ICachingService cachingService, Func<TParam1, TParam2, TParam3, TParam4, Task<TReturn>> method, TParam1 arg1, TParam2 arg2, TParam3 arg3, TParam4 arg4, CancellationToken cancellationToken = null)
Parameters
Type Name Description
ICachingService cachingService

The ICachingService.

System.Func<TParam1, TParam2, TParam3, TParam4, System.Threading.Tasks.Task<TReturn>> method

A delegate of the method to evaluate.

TParam1 arg1

Value of the first parameter.

TParam2 arg2

Value of the second parameter.

TParam3 arg3

Value of the third parameter.

TParam4 arg4

Value of the 4-th parameter.

System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TReturn>

A System.Threading.Tasks.Task<> that evaluates to the return value of method.

Type Parameters
Name Description
TReturn

The return type of the method.

TParam1

Type of the first parameter.

TParam2

Type of the second parameter.

TParam3

Type of the third parameter.

TParam4

Type of the 4-th parameter.

RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5>(ICachingService, Func<TParam1, TParam2, TParam3, TParam4, TParam5, Task<TReturn>>, TParam1, TParam2, TParam3, TParam4, TParam5, CancellationToken)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 5 parameters.

Declaration
public static Task<TReturn> RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5>(this ICachingService cachingService, Func<TParam1, TParam2, TParam3, TParam4, TParam5, Task<TReturn>> method, TParam1 arg1, TParam2 arg2, TParam3 arg3, TParam4 arg4, TParam5 arg5, CancellationToken cancellationToken = null)
Parameters
Type Name Description
ICachingService cachingService

The ICachingService.

System.Func<TParam1, TParam2, TParam3, TParam4, TParam5, System.Threading.Tasks.Task<TReturn>> method

A delegate of the method to evaluate.

TParam1 arg1

Value of the first parameter.

TParam2 arg2

Value of the second parameter.

TParam3 arg3

Value of the third parameter.

TParam4 arg4

Value of the 4-th parameter.

TParam5 arg5

Value of the 5-th parameter.

System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TReturn>

A System.Threading.Tasks.Task<> that evaluates to the return value of method.

Type Parameters
Name Description
TReturn

The return type of the method.

TParam1

Type of the first parameter.

TParam2

Type of the second parameter.

TParam3

Type of the third parameter.

TParam4

Type of the 4-th parameter.

TParam5

Type of the 5-th parameter.

RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(ICachingService, Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, Task<TReturn>>, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, CancellationToken)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 6 parameters.

Declaration
public static Task<TReturn> RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6>(this ICachingService cachingService, Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, Task<TReturn>> method, TParam1 arg1, TParam2 arg2, TParam3 arg3, TParam4 arg4, TParam5 arg5, TParam6 arg6, CancellationToken cancellationToken = null)
Parameters
Type Name Description
ICachingService cachingService

The ICachingService.

System.Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, System.Threading.Tasks.Task<TReturn>> method

A delegate of the method to evaluate.

TParam1 arg1

Value of the first parameter.

TParam2 arg2

Value of the second parameter.

TParam3 arg3

Value of the third parameter.

TParam4 arg4

Value of the 4-th parameter.

TParam5 arg5

Value of the 5-th parameter.

TParam6 arg6

Value of the 6-th parameter.

System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TReturn>

A System.Threading.Tasks.Task<> that evaluates to the return value of method.

Type Parameters
Name Description
TReturn

The return type of the method.

TParam1

Type of the first parameter.

TParam2

Type of the second parameter.

TParam3

Type of the third parameter.

TParam4

Type of the 4-th parameter.

TParam5

Type of the 5-th parameter.

TParam6

Type of the 6-th parameter.

RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7>(ICachingService, Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, Task<TReturn>>, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, CancellationToken)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 7 parameters.

Declaration
public static Task<TReturn> RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7>(this ICachingService cachingService, Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, Task<TReturn>> method, TParam1 arg1, TParam2 arg2, TParam3 arg3, TParam4 arg4, TParam5 arg5, TParam6 arg6, TParam7 arg7, CancellationToken cancellationToken = null)
Parameters
Type Name Description
ICachingService cachingService

The ICachingService.

System.Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, System.Threading.Tasks.Task<TReturn>> method

A delegate of the method to evaluate.

TParam1 arg1

Value of the first parameter.

TParam2 arg2

Value of the second parameter.

TParam3 arg3

Value of the third parameter.

TParam4 arg4

Value of the 4-th parameter.

TParam5 arg5

Value of the 5-th parameter.

TParam6 arg6

Value of the 6-th parameter.

TParam7 arg7

Value of the 7-th parameter.

System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TReturn>

A System.Threading.Tasks.Task<> that evaluates to the return value of method.

Type Parameters
Name Description
TReturn

The return type of the method.

TParam1

Type of the first parameter.

TParam2

Type of the second parameter.

TParam3

Type of the third parameter.

TParam4

Type of the 4-th parameter.

TParam5

Type of the 5-th parameter.

TParam6

Type of the 6-th parameter.

TParam7

Type of the 7-th parameter.

RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8>(ICachingService, Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, Task<TReturn>>, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, CancellationToken)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 8 parameters.

Declaration
public static Task<TReturn> RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8>(this ICachingService cachingService, Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, Task<TReturn>> method, TParam1 arg1, TParam2 arg2, TParam3 arg3, TParam4 arg4, TParam5 arg5, TParam6 arg6, TParam7 arg7, TParam8 arg8, CancellationToken cancellationToken = null)
Parameters
Type Name Description
ICachingService cachingService

The ICachingService.

System.Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, System.Threading.Tasks.Task<TReturn>> method

A delegate of the method to evaluate.

TParam1 arg1

Value of the first parameter.

TParam2 arg2

Value of the second parameter.

TParam3 arg3

Value of the third parameter.

TParam4 arg4

Value of the 4-th parameter.

TParam5 arg5

Value of the 5-th parameter.

TParam6 arg6

Value of the 6-th parameter.

TParam7 arg7

Value of the 7-th parameter.

TParam8 arg8

Value of the 8-th parameter.

System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TReturn>

A System.Threading.Tasks.Task<> that evaluates to the return value of method.

Type Parameters
Name Description
TReturn

The return type of the method.

TParam1

Type of the first parameter.

TParam2

Type of the second parameter.

TParam3

Type of the third parameter.

TParam4

Type of the 4-th parameter.

TParam5

Type of the 5-th parameter.

TParam6

Type of the 6-th parameter.

TParam7

Type of the 7-th parameter.

TParam8

Type of the 8-th parameter.

RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9>(ICachingService, Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, Task<TReturn>>, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, CancellationToken)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 9 parameters.

Declaration
public static Task<TReturn> RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9>(this ICachingService cachingService, Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, Task<TReturn>> method, TParam1 arg1, TParam2 arg2, TParam3 arg3, TParam4 arg4, TParam5 arg5, TParam6 arg6, TParam7 arg7, TParam8 arg8, TParam9 arg9, CancellationToken cancellationToken = null)
Parameters
Type Name Description
ICachingService cachingService

The ICachingService.

System.Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, System.Threading.Tasks.Task<TReturn>> method

A delegate of the method to evaluate.

TParam1 arg1

Value of the first parameter.

TParam2 arg2

Value of the second parameter.

TParam3 arg3

Value of the third parameter.

TParam4 arg4

Value of the 4-th parameter.

TParam5 arg5

Value of the 5-th parameter.

TParam6 arg6

Value of the 6-th parameter.

TParam7 arg7

Value of the 7-th parameter.

TParam8 arg8

Value of the 8-th parameter.

TParam9 arg9

Value of the 9-th parameter.

System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TReturn>

A System.Threading.Tasks.Task<> that evaluates to the return value of method.

Type Parameters
Name Description
TReturn

The return type of the method.

TParam1

Type of the first parameter.

TParam2

Type of the second parameter.

TParam3

Type of the third parameter.

TParam4

Type of the 4-th parameter.

TParam5

Type of the 5-th parameter.

TParam6

Type of the 6-th parameter.

TParam7

Type of the 7-th parameter.

TParam8

Type of the 8-th parameter.

TParam9

Type of the 9-th parameter.

RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10>(ICachingService, Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, Task<TReturn>>, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, CancellationToken)

Asynchronously evaluates a method, ignoring the currently cached value, and replaces the corresponding cache item with the new return value of the method. This overload is for methods with 10 parameters.

Declaration
public static Task<TReturn> RefreshAsync<TReturn, TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10>(this ICachingService cachingService, Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, Task<TReturn>> method, TParam1 arg1, TParam2 arg2, TParam3 arg3, TParam4 arg4, TParam5 arg5, TParam6 arg6, TParam7 arg7, TParam8 arg8, TParam9 arg9, TParam10 arg10, CancellationToken cancellationToken = null)
Parameters
Type Name Description
ICachingService cachingService

The ICachingService.

System.Func<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TParam8, TParam9, TParam10, System.Threading.Tasks.Task<TReturn>> method

A delegate of the method to evaluate.

TParam1 arg1

Value of the first parameter.

TParam2 arg2

Value of the second parameter.

TParam3 arg3

Value of the third parameter.

TParam4 arg4

Value of the 4-th parameter.

TParam5 arg5

Value of the 5-th parameter.

TParam6 arg6

Value of the 6-th parameter.

TParam7 arg7

Value of the 7-th parameter.

TParam8 arg8

Value of the 8-th parameter.

TParam9 arg9

Value of the 9-th parameter.

TParam10 arg10

Value of the 10-th parameter.

System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TReturn>

A System.Threading.Tasks.Task<> that evaluates to the return value of method.

Type Parameters
Name Description
TReturn

The return type of the method.

TParam1

Type of the first parameter.

TParam2

Type of the second parameter.

TParam3

Type of the third parameter.

TParam4

Type of the 4-th parameter.

TParam5

Type of the 5-th parameter.

TParam6

Type of the 6-th parameter.

TParam7

Type of the 7-th parameter.

TParam8

Type of the 8-th parameter.

TParam9

Type of the 9-th parameter.

TParam10

Type of the 10-th parameter.