November Happy Hour will be moved to Thursday December 5th.

Class CatalogCache

Implements operations for the cache for the catalog system.

Inheritance
System.Object
CatalogCache
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.Commerce.Catalog
Assembly: Mediachase.Commerce.dll
Version: 13.30.0
Syntax
public sealed class CatalogCache

Constructors

CatalogCache()

Declaration
public CatalogCache()

Methods

Clear()

Removes all items from the catalog cache depended on by all inserts.

Declaration
public static void Clear()

CreateCacheKey(CultureInfo, String[])

Creates the cache key.

Declaration
public static string CreateCacheKey(CultureInfo culture, params string[] keys)
Parameters
Type Name Description
System.Globalization.CultureInfo culture

The culture of the cached object.

System.String[] keys

The elements to include in the key.

Returns
Type Description
System.String

A cache key with the specified culture and the specified elements.

CreateCacheKey(String)

Creates a non-language-specific cache key.

Declaration
public static string CreateCacheKey(string key)
Parameters
Type Name Description
System.String key

The element to include in the key.

Returns
Type Description
System.String

A cache key with the current culture and the specified elements.

CreateCacheKey(String, String)

Creates a non-language-specific cache key.

Declaration
public static string CreateCacheKey(string key1, string key2)
Parameters
Type Name Description
System.String key1

The first element to include in the key.

System.String key2

The second element to include in the key.

Returns
Type Description
System.String

A cache key with the current culture and the specified elements.

CreateCacheKey(String, String, String)

Creates a non-language-specific cache key.

Declaration
public static string CreateCacheKey(string key1, string key2, string key3)
Parameters
Type Name Description
System.String key1

The first element to include in the key.

System.String key2

The second element to include in the key.

System.String key3

The third element to include in the key.

Returns
Type Description
System.String

A cache key with the current culture and the specified elements.

CreateCacheKey(String[])

Creates a non-language-specific cache key.

Declaration
public static string CreateCacheKey(params string[] keys)
Parameters
Type Name Description
System.String[] keys

The elements to include in the key.

Returns
Type Description
System.String

A cache key with the current culture and the specified elements.

CreateLocalizedCacheKey(String, String)

Creates the cache key with a specific language

Declaration
public static string CreateLocalizedCacheKey(string language, string key)
Parameters
Type Name Description
System.String language

The language of the cached object.

System.String key

The element to include in the key.

Returns
Type Description
System.String

A cache key with the specified culture and the specified elements.

CreateLocalizedCacheKey(String, String, String)

Creates the cache key with a specific language

Declaration
public static string CreateLocalizedCacheKey(string language, string key1, string key2)
Parameters
Type Name Description
System.String language

The language of the cached object.

System.String key1

The first element to include in the key.

System.String key2

The second element to include in the key.

Returns
Type Description
System.String

A cache key with the specified culture and the specified elements.

CreateLocalizedCacheKey(String, String, String, String)

Creates the cache key with a specific language

Declaration
public static string CreateLocalizedCacheKey(string language, string key1, string key2, string key3)
Parameters
Type Name Description
System.String language

The language of the cached object.

System.String key1

The first element to include in the key.

System.String key2

The second element to include in the key.

System.String key3

The third element to include in the key.

Returns
Type Description
System.String

A cache key with the specified culture and the specified elements.

CreateLocalizedCacheKey(String, String[])

Creates the cache key with a specific language

Declaration
public static string CreateLocalizedCacheKey(string language, params string[] keys)
Parameters
Type Name Description
System.String language

The language of the cached object.

System.String[] keys

The elements to include in the key.

Returns
Type Description
System.String

A cache key with the specified culture and the specified elements.

Get(String)

Retrieves a value from the cache by key.

Declaration
public static object Get(string key)
Parameters
Type Name Description
System.String key

The cache key.

Returns
Type Description
System.Object

The cached value for the key, or null if the key is not found.

Insert(String, Object, IEnumerable<String>, TimeSpan)

Inserts the value into the cache with the specified key, with dependency to a set of master keys.

Declaration
public static void Insert(string key, object value, IEnumerable<string> masterKeys, TimeSpan timeout)
Parameters
Type Name Description
System.String key

The key.

System.Object value

The value to cache.

System.Collections.Generic.IEnumerable<System.String> masterKeys

The master keys that we depend upon. These don't have to exist in the cache, they will be inserted if they don't exist.

System.TimeSpan timeout

The cache timeout.

Insert(String, Object, TimeSpan)

Inserts the value into the cache with the specified key, with dependency to a master key.

Declaration
public static void Insert(string key, object value, TimeSpan timeout)
Parameters
Type Name Description
System.String key

The key.

System.Object value

The value to cache.

System.TimeSpan timeout

The cache timeout.

ReadThrough<T>(ReadMode, String, IEnumerable<String>, TimeSpan, Func<T>)

Read-through cache handling with ReadMode support and using EPiServer.Framework.Cache.ReadStrategy.Wait.

Declaration
public static T ReadThrough<T>(ReadMode readMode, string key, IEnumerable<string> masterKeys, TimeSpan timeout, Func<T> load)
    where T : class
Parameters
Type Name Description
ReadMode readMode

The read mode.

System.String key

The key.

System.Collections.Generic.IEnumerable<System.String> masterKeys

The master keys that the cached item should depend on.

System.TimeSpan timeout

The cache timeout.

System.Func<T> load

The function to invoke for retrieving the value if it does not exist in the cache.

Returns
Type Description
T

The object associated with the key, if it exists or is read thru the readValue fuction. Otherwise returns null.

Type Parameters
Name Description
T

Type of the value to read.

ReadThrough<T>(String, IEnumerable<String>, TimeSpan, Func<T>)

Read-through cache handling.

Declaration
public static T ReadThrough<T>(string key, IEnumerable<string> masterKeys, TimeSpan timeout, Func<T> load)
    where T : class
Parameters
Type Name Description
System.String key

The key.

System.Collections.Generic.IEnumerable<System.String> masterKeys

The master keys that the cached item should depend on.

System.TimeSpan timeout

The cache timeout.

System.Func<T> load

The function to invoke for retrieving the value if it does not exist in the cache.

Returns
Type Description
T

The object associated with the key, if it exists or is read thru the readValue fuction. Otherwise returns null.

Type Parameters
Name Description
T

Type of the value to read.

Remove(String)

Removes the specified item from the cache.

Declaration
public static void Remove(string key)
Parameters
Type Name Description
System.String key

The key of the item to remove.