Class CacheHelperExtensionMethods
Extension methods for the IObjectCache interface
Inheritance
System.Object
CacheHelperExtensionMethods
Assembly: ImageVault.Common.dll
Syntax
public static class CacheHelperExtensionMethods : Object
Methods
GetOrCreate<T>(CacheHelper, String, Func<T>)
Gets or creates a cache without expiration
Declaration
public static T GetOrCreate<T>(this CacheHelper helper, string name, Func<T> createAction)
Parameters
Type |
Name |
Description |
CacheHelper |
helper |
|
System.String |
name |
|
System.Func<T> |
createAction |
|
Returns
Type Parameters
GetOrCreateAbsoluteCache<T>(CacheHelper, String, TimeSpan, Func<T>)
Gets or creates a cache with an absolute expiration
Declaration
public static T GetOrCreateAbsoluteCache<T>(this CacheHelper helper, string name, TimeSpan absoluteExpiration, Func<T> createAction)
Parameters
Type |
Name |
Description |
CacheHelper |
helper |
|
System.String |
name |
|
System.TimeSpan |
absoluteExpiration |
|
System.Func<T> |
createAction |
|
Returns
Type Parameters
GetOrCreateAbsoluteCacheAsync<T>(CacheHelper, String, TimeSpan, Func<Task<T>>)
Declaration
public static Task<T> GetOrCreateAbsoluteCacheAsync<T>(this CacheHelper helper, string name, TimeSpan absoluteExpiration, Func<Task<T>> createAction)
Parameters
Type |
Name |
Description |
CacheHelper |
helper |
|
System.String |
name |
|
System.TimeSpan |
absoluteExpiration |
|
System.Func<System.Threading.Tasks.Task<T>> |
createAction |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<T> |
|
Type Parameters
GetOrCreateSlidingCache<T>(CacheHelper, String, TimeSpan, Func<T>)
Gets or creates a cache with a sliding expiration
Declaration
public static T GetOrCreateSlidingCache<T>(this CacheHelper helper, string name, TimeSpan slidingExpiration, Func<T> createAction)
Parameters
Type |
Name |
Description |
CacheHelper |
helper |
|
System.String |
name |
|
System.TimeSpan |
slidingExpiration |
|
System.Func<T> |
createAction |
|
Returns
Type Parameters
TryGet<T>(CacheHelper, String, out T)
Declaration
public static bool TryGet<T>(this CacheHelper helper, string name, out T value)
Parameters
Type |
Name |
Description |
CacheHelper |
helper |
|
System.String |
name |
|
T |
value |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
TryGetOrCreate<T>(CacheHelper, String, Func<T>, out T)
Declaration
public static bool TryGetOrCreate<T>(this CacheHelper helper, string name, Func<T> createAction, out T value)
Parameters
Type |
Name |
Description |
CacheHelper |
helper |
|
System.String |
name |
|
System.Func<T> |
createAction |
|
T |
value |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters