Class ObjectInstanceCacheExtensions
Extension methods for EPiServer.Framework.Cache.IObjectInstanceCache
Inheritance
Inherited Members
Namespace: Mediachase.Data.Provider.Internal.Extensions
Assembly: Mediachase.DataProvider.dll
Version: 13.30.0Syntax
public static class ObjectInstanceCacheExtensions
Methods
ReadThrough<T>(IObjectInstanceCache, ReadMode, String, Func<T>, IEnumerable<String>, TimeSpan)
Reads data according to the supplied readMode
, and using EPiServer.Framework.Cache.ReadStrategy.Wait.
Declaration
public static T ReadThrough<T>(this IObjectInstanceCache cache, ReadMode readMode, string cacheKey, Func<T> load, IEnumerable<string> masterKeys, TimeSpan duration)
where T : class
Parameters
Type | Name | Description |
---|---|---|
EPiServer.Framework.Cache.IObjectInstanceCache | cache | The cache implementation to use. |
ReadMode | readMode | The read mode |
System.String | cacheKey | The cache key for the item. |
System.Func<T> | load | The delegate to execute to get the item if it is not in cache. |
System.Collections.Generic.IEnumerable<System.String> | masterKeys | The master keys the cached item should depend on. |
System.TimeSpan | duration | The cache duration. |
Returns
Type | Description |
---|---|
T | The item from cache or as returned by the delegate if not in cache or the cache is not used in the specified read mode. |
Type Parameters
Name | Description |
---|---|
T | The type of item. |
ReadThrough<T>(IObjectInstanceCache, ReadMode, String, Func<T>, Func<T, CacheEvictionPolicy>)
Reads data according to the supplied readMode
, and using EPiServer.Framework.Cache.ReadStrategy.Wait.
Declaration
public static T ReadThrough<T>(this IObjectInstanceCache cache, ReadMode readMode, string cacheKey, Func<T> load, Func<T, CacheEvictionPolicy> evictionPolicy)
where T : class
Parameters
Type | Name | Description |
---|---|---|
EPiServer.Framework.Cache.IObjectInstanceCache | cache | The cache implementation to use. |
ReadMode | readMode | The read mode |
System.String | cacheKey | The cache key for the item. |
System.Func<T> | load | The delegate to execute to get the item if it is not in cache. |
System.Func<T, EPiServer.Framework.Cache.CacheEvictionPolicy> | evictionPolicy | The cache eviciton policy. |
Returns
Type | Description |
---|---|
T | The item from cache or as returned by the delegate if not in cache or the cache is not used in the specified read mode. |
Type Parameters
Name | Description |
---|---|
T | The type of item. |